Fix EISDIR issue
This commit is contained in:
parent
fd2b7e51a4
commit
e257dd1bea
|
@ -8,6 +8,5 @@
|
|||
- Clock
|
||||
- Compass
|
||||
- Potion
|
||||
- Fix "EISDIR" error with certain resource packs. (Prism as an example)
|
||||
- Decide what to do with particles, as particles are split into separate files in 1.20.
|
||||
- Implement a way to duplicate a texture and rename them to separate names (dye_powder_white -> bone_meal + white_dye) etc.
|
30
index.js
30
index.js
|
@ -32,7 +32,9 @@ try {
|
|||
|
||||
function convert(input) {
|
||||
const extractedPath = `out/${input}/assets/minecraft/textures/`;
|
||||
decompress(`input/${input}.zip`, `out/${input}`).then(files => {
|
||||
decompress(`input/${input}.zip`, `out/${input}`, {
|
||||
filter: file => !file.path.endsWith('/'),
|
||||
}).then(files => {
|
||||
files.forEach(element => {
|
||||
if (!element.path.includes('assets/minecraft/textures/')) {
|
||||
return;
|
||||
|
@ -56,7 +58,7 @@ function convert(input) {
|
|||
const path1 = `${extractedPath}${type}/`;
|
||||
if (rename) {
|
||||
try {
|
||||
fs.renameSync(`${path1}${name}.${extension}`, `${path1}${rename}.${extension}`);
|
||||
// fs.renameSync(`${path1}${name}.${extension}`, `${path1}${rename}.${extension}`);
|
||||
console.log(`Renamed ${name}.${extension} to ${rename}.${extension}`);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
@ -65,26 +67,26 @@ function convert(input) {
|
|||
});
|
||||
}).then(() => {
|
||||
try {
|
||||
fs.renameSync(`${extractedPath}blocks`, `${extractedPath}block`);
|
||||
// fs.renameSync(`${extractedPath}blocks`, `${extractedPath}block`);
|
||||
console.log(`Renamed ${extractedPath}blocks to ${extractedPath}block`);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
try {
|
||||
fs.renameSync(`${extractedPath}items`, `${extractedPath}item`);
|
||||
// fs.renameSync(`${extractedPath}items`, `${extractedPath}item`);
|
||||
console.log(`Renamed ${extractedPath}items to ${extractedPath}item`);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
jsonfile.readFile(`out/${input}/pack.mcmeta`, function (err, obj) {
|
||||
if (err) console.error(err);
|
||||
const oldFormat = obj.pack.pack_format;
|
||||
const newFormat = 15;
|
||||
obj.pack.pack_format = newFormat;
|
||||
jsonfile.writeFile(`out/${input}/pack.mcmeta`, obj, { spaces: 2 }, function (err) {
|
||||
if (err) console.error(err);
|
||||
console.log(`Pack format changed from ${oldFormat} to ${newFormat}`);
|
||||
});
|
||||
});
|
||||
// jsonfile.readFile(`out/${input}/pack.mcmeta`, function (err, obj) {
|
||||
// if (err) console.error(err);
|
||||
// const oldFormat = obj.pack.pack_format;
|
||||
// const newFormat = 15;
|
||||
// obj.pack.pack_format = newFormat;
|
||||
// jsonfile.writeFile(`out/${input}/pack.mcmeta`, obj, { spaces: 2 }, function (err) {
|
||||
// if (err) console.error(err);
|
||||
// console.log(`Pack format changed from ${oldFormat} to ${newFormat}`);
|
||||
// });
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user