Bug Fixes and Extra Checks

I had set an emoji to emoji.thumb_down when it doesn't exist. Changed to emoji.heavy_check, I even used the wrong one for the context!

Added extra checks for the image directory to make sure it exists before continuing.
This commit is contained in:
tgpethan 2019-09-08 13:36:37 +01:00
parent 1b54c54b83
commit bbdb115f7a

View file

@ -7,11 +7,10 @@ internals = {
c:"WARN" c:"WARN"
} }
}; };
let dE = new Date(), startTime = dE.getTime(), endTime, modules = [], img_json; let dE = new Date(), startTime = dE.getTime(), endTime, modules = [], image_json;
// Clear console before printing anything // Clear console before printing anything
console.clear(); console.clear();
fs.readFile('./misc/ascii.txt', function(err, data) { fs.readFile('./misc/ascii.txt', function(err, data) {
if (err) throw err; if (err) throw err;
fs.readdir(config.server.image_dir, (err, files) => { fs.readdir(config.server.image_dir, (err, files) => {
@ -44,12 +43,18 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
if (error) { if (error) {
fs.writeFile('./image-type.json', '{\n\}', function(err) { fs.writeFile('./image-type.json', '{\n\}', function(err) {
if (err) throw err; if (err) throw err;
modules.logger.log(internals.types.a, emoji.thumb_down, "Created image-type File!"); modules.logger.log(internals.types.a, emoji.heavy_check, "Created image-type File!");
image_json = require("./image-type.json");
}); });
} else { } else {
image_json = require("./image-type.json"); image_json = require("./image-type.json");
} }
}); });
fs.access(config.server.image_dir, error => {
if (error) {
fs.mkdirSync(config.server.image_dir);
}
});
modules.logger.log(internals.types.a, emoji.wave, "Starting Revolution..."); modules.logger.log(internals.types.a, emoji.wave, "Starting Revolution...");
server(); server();
}); });