allow startup without settings file
This commit is contained in:
parent
6fc45d6252
commit
90bbf169b2
|
@ -106,8 +106,14 @@ if (settingsFilename.charAt(0) != '/') {
|
||||||
settingsFilename = path.normalize(path.join(root, settingsFilename));
|
settingsFilename = path.normalize(path.join(root, settingsFilename));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var settingsStr
|
||||||
|
try{
|
||||||
//read the settings sync
|
//read the settings sync
|
||||||
var settingsStr = fs.readFileSync(settingsFilename).toString();
|
settingsStr = fs.readFileSync(settingsFilename).toString();
|
||||||
|
} catch(e){
|
||||||
|
console.warn('No settings file found. Using defaults.');
|
||||||
|
settingsStr = '{}';
|
||||||
|
}
|
||||||
|
|
||||||
//remove all comments
|
//remove all comments
|
||||||
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");
|
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");
|
||||||
|
|
Loading…
Reference in New Issue