Merge pull request #33 from DecentralisedTech/master

Change require imports to fs
This commit is contained in:
Pierce 2020-01-20 10:06:15 -05:00 committed by GitHub
commit 8fbe1faaa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -147,7 +147,7 @@ class Handler {
`${this.version.assetIndex.id}.json`, true, 'asset-json');
}
const index = require(path.join(this.options.root, 'assets', 'indexes',`${this.version.assetIndex.id}.json`));
const index = JSON.parse(fs.readFileSync(path.join(this.options.root, 'assets', 'indexes',`${this.version.assetIndex.id}.json`), { encoding: 'utf8' }));
this.client.emit('progress', {
type: 'assets',
@ -309,7 +309,7 @@ class Handler {
return null;
}
const forge = require(path.join(this.options.root, 'forge', `${this.version.id}`, 'version.json'));
const forge = JSON.parse(fs.readFileSync(path.join(this.options.root, 'forge', `${this.version.id}`, 'version.json'), { encoding: 'utf8' }));
const paths = [];
this.client.emit('progress', {
@ -376,7 +376,7 @@ class Handler {
const libs = [];
if(this.options.version.custom) {
const customJarJson = require(path.join(this.options.root, 'versions', this.options.version.custom, `${this.options.version.custom}.json`));
const customJarJson = JSON.parse(fs.readFileSync(path.join(this.options.root, 'versions', this.options.version.custom, `${this.options.version.custom}.json`), { encoding: 'utf9'}));
this.client.emit('progress', {
type: 'classes-custom',

View file

@ -27,7 +27,7 @@ class MCLCore extends EventEmitter {
// Lets the events register. our magic switch!
await void(0);
this.emit('debug', `[MCLC]: MCLC version ${require(path.join(__dirname,'..', 'package.json')).version}`);
this.emit('debug', `[MCLC]: MCLC version ${JSON.parse(fs.readFileSync(path.join(__dirname,'..', 'package.json'), { encoding: 'utf8' })).version}`);
const java = await this.handler.checkJava(this.options.javaPath || 'java');
if(!java.run) {
this.emit('debug', `[MCLC]: Couldn't start Minecraft due to: ${java.message}`);
@ -75,7 +75,7 @@ class MCLCore extends EventEmitter {
}
if(this.options.version.custom) {
this.emit('debug', '[MCLC]: Detected custom in options, setting custom version file');
custom = require(path.join(this.options.root, 'versions', this.options.version.custom, `${this.options.version.custom}.json`));
custom = JSON.parse(fs.readFileSync(path.join(this.options.root, 'versions', this.options.version.custom, `${this.options.version.custom}.json`), { encoding: 'utf8' }));
}
const args = [];