Update simulator
This commit is contained in:
parent
640c4b162e
commit
ab52c0eff7
1
index.js
1
index.js
@ -12,6 +12,7 @@ let configs = {
|
||||
assets: config.get('assets'),
|
||||
sounds: config.get('sounds'),
|
||||
settings: config.get('settings'),
|
||||
elogs: config.get('elogs'),
|
||||
}
|
||||
|
||||
// Start simulation.
|
||||
|
@ -10,7 +10,7 @@ class Simulator {
|
||||
constructor(configs) {
|
||||
|
||||
this.configs = configs;
|
||||
|
||||
|
||||
// Read assets ids from configs
|
||||
this.assetIds = configs.assets.ids;
|
||||
|
||||
@ -37,19 +37,20 @@ class Simulator {
|
||||
}
|
||||
|
||||
_manageLogs(callback) {
|
||||
fs.readdir('logs', (err, files) => {
|
||||
try {
|
||||
fs.unlinkSync(path.join('logs/', 'error_'+this.configs.elogs.name+'.log'), err => {
|
||||
if (err) throw err;
|
||||
for (const file of files) {
|
||||
fs.unlinkSync(path.join('logs', file), err => {
|
||||
if (err) throw err;
|
||||
});
|
||||
}
|
||||
});
|
||||
fs.unlinkSync(path.join('logs/', 'simulator_'+this.configs.elogs.name+'.log'), err => {
|
||||
if (err) throw err;
|
||||
});
|
||||
} catch(e) { console.log(e) }
|
||||
fs.openSync('./logs/simulator_'+this.configs.elogs.name+'.log', 'w');
|
||||
utils.writeLog('START');
|
||||
utils.writeLog(`process.env["NODE_CONFIG_DIR"]: ${process.env["NODE_CONFIG_DIR"]}`);
|
||||
|
||||
fs.openSync('./logs/error_'+this.configs.elogs.name+'.log', 'w');
|
||||
});
|
||||
|
||||
return callback();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user