Fix EISDIR issue
This commit is contained in:
parent
fd2b7e51a4
commit
e257dd1bea
|
@ -8,6 +8,5 @@
|
||||||
- Clock
|
- Clock
|
||||||
- Compass
|
- Compass
|
||||||
- Potion
|
- 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.
|
- 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.
|
- 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) {
|
function convert(input) {
|
||||||
const extractedPath = `out/${input}/assets/minecraft/textures/`;
|
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 => {
|
files.forEach(element => {
|
||||||
if (!element.path.includes('assets/minecraft/textures/')) {
|
if (!element.path.includes('assets/minecraft/textures/')) {
|
||||||
return;
|
return;
|
||||||
|
@ -56,7 +58,7 @@ function convert(input) {
|
||||||
const path1 = `${extractedPath}${type}/`;
|
const path1 = `${extractedPath}${type}/`;
|
||||||
if (rename) {
|
if (rename) {
|
||||||
try {
|
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}`);
|
console.log(`Renamed ${name}.${extension} to ${rename}.${extension}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -65,26 +67,26 @@ function convert(input) {
|
||||||
});
|
});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
try {
|
try {
|
||||||
fs.renameSync(`${extractedPath}blocks`, `${extractedPath}block`);
|
// fs.renameSync(`${extractedPath}blocks`, `${extractedPath}block`);
|
||||||
console.log(`Renamed ${extractedPath}blocks to ${extractedPath}block`);
|
console.log(`Renamed ${extractedPath}blocks to ${extractedPath}block`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
fs.renameSync(`${extractedPath}items`, `${extractedPath}item`);
|
// fs.renameSync(`${extractedPath}items`, `${extractedPath}item`);
|
||||||
console.log(`Renamed ${extractedPath}items to ${extractedPath}item`);
|
console.log(`Renamed ${extractedPath}items to ${extractedPath}item`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
jsonfile.readFile(`out/${input}/pack.mcmeta`, function (err, obj) {
|
// jsonfile.readFile(`out/${input}/pack.mcmeta`, function (err, obj) {
|
||||||
if (err) console.error(err);
|
// if (err) console.error(err);
|
||||||
const oldFormat = obj.pack.pack_format;
|
// const oldFormat = obj.pack.pack_format;
|
||||||
const newFormat = 15;
|
// const newFormat = 15;
|
||||||
obj.pack.pack_format = newFormat;
|
// obj.pack.pack_format = newFormat;
|
||||||
jsonfile.writeFile(`out/${input}/pack.mcmeta`, obj, { spaces: 2 }, function (err) {
|
// jsonfile.writeFile(`out/${input}/pack.mcmeta`, obj, { spaces: 2 }, function (err) {
|
||||||
if (err) console.error(err);
|
// if (err) console.error(err);
|
||||||
console.log(`Pack format changed from ${oldFormat} to ${newFormat}`);
|
// console.log(`Pack format changed from ${oldFormat} to ${newFormat}`);
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user