fixing config.json not existing causing a crash

This commit is contained in:
Sören Oesterwind 2022-07-13 18:24:17 +02:00
parent ffcd716038
commit fcc2172f1f

View File

@ -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));