From 828f53a8d152b4a37549890f796c29263ee1ba13 Mon Sep 17 00:00:00 2001 From: tgpethan Date: Mon, 15 Jun 2020 08:30:16 +0100 Subject: [PATCH] Change some other function to sync alternatives & put a / in the exists --- EUS.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/EUS.js b/EUS.js index 371c23b..8e66732 100644 --- a/EUS.js +++ b/EUS.js @@ -38,12 +38,10 @@ if (!fs.existsSync(__dirname + BASE_PATH + "/i")) { // Makes the image-type file if (fs.existsSync(__dirname + BASE_PATH + "image-type.json")) { // Doesn't exist, create it. - fs.writeFile(`${__dirname}${BASE_PATH}/image-type.json`, '{\n}', function(err) { - if (err) throw err; - console.log("[EUS] Created image-type File!"); - // File has been created, load it. - image_json = require(`${__dirname}${BASE_PATH}/image-type.json`); - }); + fs.writeFileSync(`${__dirname}${BASE_PATH}/image-type.json`, '{}'); + console.log("[EUS] Created image-type File!"); + // File has been created, load it. + image_json = require(`${__dirname}${BASE_PATH}/image-type.json`); } else { // File already exists, load it. image_json = require(`${__dirname}${BASE_PATH}/image-type.json`); @@ -52,13 +50,11 @@ if (fs.existsSync(__dirname + BASE_PATH + "image-type.json")) { // Makes the config file if (fs.existsSync(__dirname + BASE_PATH + "config.json")) { // Config doesn't exist, make it. - fs.writeFile(`${__dirname}${BASE_PATH}/config.json`, '{\n\t"baseURL":"http://example.com/",\n\t"acceptedTypes": [\n\t\t".png",\n\t\t".jpg",\n\t\t".jpeg",\n\t\t".gif"\n\t],\n\t"uploadKey": ""\n}', function(err) { - if (err) throw err; - console.log("[EUS] Created config File!"); - console.log("[EUS] Please edit the EUS Config file before restarting."); - // Config has been made, close framework. - process.exit(0); - }); + fs.writeFileSync(`${__dirname}${BASE_PATH}/config.json`, '{\n\t"baseURL":"http://example.com/",\n\t"acceptedTypes": [\n\t\t".png",\n\t\t".jpg",\n\t\t".jpeg",\n\t\t".gif"\n\t],\n\t"uploadKey": ""\n}'); + console.log("[EUS] Created config File!"); + console.log("[EUS] Please edit the EUS Config file before restarting."); + // Config has been made, close framework. + process.exit(0); } else { eusConfig = require(`${__dirname}${BASE_PATH}/config.json`); if (validateConfig(eusConfig)) console.log("[EUS] EUS config passed all checks");