fixing config.json not existing causing a crash
This commit is contained in:
parent
ffcd716038
commit
fcc2172f1f
4
index.js
4
index.js
@ -58,7 +58,9 @@ currentState = {
|
||||
let configObject = {
|
||||
language: "en_uk"
|
||||
}
|
||||
|
||||
if(!fs.existsSync("config.json")) {
|
||||
fs.writeFileSync("config.json", "{}");
|
||||
}
|
||||
const tempJsonText = JSON.parse(fs.readFileSync("config.json", "utf8"));
|
||||
configObject = _.extend(configObject, tempJsonText);
|
||||
fs.writeFileSync("config.json", JSON.stringify(configObject));
|
||||
|
Loading…
Reference in New Issue
Block a user