Skip to content

Commit

Permalink
require fs
Browse files Browse the repository at this point in the history
  • Loading branch information
aidant19 committed Jan 10, 2024
1 parent d057bcb commit 573d8de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scripts/ajexport.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// https://discord.com/channels/314078526104141834/1189404550986211329/1189517519262855229

/*
global Project, fs, loadModelFile, AnimatedJava
global Project, loadModelFile, AnimatedJava
*/

const { readdirSync, readFileSync } = require('fs');

const consoleLogJson = (args) => {
console.log(JSON.stringify(args));
};
Expand All @@ -17,7 +19,7 @@ const paths = getConfigPaths(
);
const dir = paths[3].concat('/');
console.log('Target paths: ', paths);
const files = fs.readdirSync(dir).filter((file) => file.includes('ajmodel'));
const files = readdirSync(dir).filter((file) => file.includes('ajmodel'));
const exportNextFile = () => {
if (Project) {
Project.close();
Expand All @@ -28,7 +30,7 @@ const exportNextFile = () => {
}
consoleLogJson({ file });
if (file.includes('ajmodel')) {
let content = fs.readFileSync(dir.concat(file), 'utf-8');
let content = readFileSync(dir.concat(file), 'utf-8');
let name = file.split('/').pop();
let fileObj = {
path: file,
Expand Down Expand Up @@ -98,7 +100,7 @@ function injectModelPackPaths(modelContent, paths) {
}

function getConfigPaths(configFile) {
const f = JSON.parse(fs.readFileSync(configFile).toString());
const f = JSON.parse(readFileSync(configFile).toString());
let resourcePackPath = f.resource_pack_mcmeta;
let dataPackPath = f.datapack_mcmeta;
let assetsPath = f.assets_path;
Expand Down

0 comments on commit 573d8de

Please sign in to comment.