Change some other function to sync alternatives & put a / in the exists
This commit is contained in:
parent
076128d7f2
commit
828f53a8d1
1 changed files with 9 additions and 13 deletions
22
EUS.js
22
EUS.js
|
@ -38,12 +38,10 @@ if (!fs.existsSync(__dirname + BASE_PATH + "/i")) {
|
||||||
// Makes the image-type file
|
// Makes the image-type file
|
||||||
if (fs.existsSync(__dirname + BASE_PATH + "image-type.json")) {
|
if (fs.existsSync(__dirname + BASE_PATH + "image-type.json")) {
|
||||||
// Doesn't exist, create it.
|
// Doesn't exist, create it.
|
||||||
fs.writeFile(`${__dirname}${BASE_PATH}/image-type.json`, '{\n}', function(err) {
|
fs.writeFileSync(`${__dirname}${BASE_PATH}/image-type.json`, '{}');
|
||||||
if (err) throw err;
|
console.log("[EUS] Created image-type File!");
|
||||||
console.log("[EUS] Created image-type File!");
|
// File has been created, load it.
|
||||||
// File has been created, load it.
|
image_json = require(`${__dirname}${BASE_PATH}/image-type.json`);
|
||||||
image_json = require(`${__dirname}${BASE_PATH}/image-type.json`);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// File already exists, load it.
|
// File already exists, load it.
|
||||||
image_json = require(`${__dirname}${BASE_PATH}/image-type.json`);
|
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
|
// Makes the config file
|
||||||
if (fs.existsSync(__dirname + BASE_PATH + "config.json")) {
|
if (fs.existsSync(__dirname + BASE_PATH + "config.json")) {
|
||||||
// Config doesn't exist, make it.
|
// 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) {
|
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}');
|
||||||
if (err) throw err;
|
console.log("[EUS] Created config File!");
|
||||||
console.log("[EUS] Created config File!");
|
console.log("[EUS] Please edit the EUS Config file before restarting.");
|
||||||
console.log("[EUS] Please edit the EUS Config file before restarting.");
|
// Config has been made, close framework.
|
||||||
// Config has been made, close framework.
|
process.exit(0);
|
||||||
process.exit(0);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
eusConfig = require(`${__dirname}${BASE_PATH}/config.json`);
|
eusConfig = require(`${__dirname}${BASE_PATH}/config.json`);
|
||||||
if (validateConfig(eusConfig)) console.log("[EUS] EUS config passed all checks");
|
if (validateConfig(eusConfig)) console.log("[EUS] EUS config passed all checks");
|
||||||
|
|
Loading…
Reference in a new issue