optional settings-file

This commit is contained in:
Patrick Pfeiffer 2012-01-21 10:30:23 +01:00
parent 6188c88e4a
commit 2874e1b904

View file

@ -87,11 +87,20 @@ exports.abiwordAvailable = function()
} }
} }
//read the settings sync var settingsStr = '{}';
var settingsStr = fs.readFileSync(__dirname+"/../../settings.json").toString();
//remove all comments try
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,""); {
//read the settings sync
settingsStr = fs.readFileSync(__dirname+"/../../settings.json").toString();
//remove all comments
settingsStr = settingsStr.replace(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/gm,"").replace(/#.*/g,"").replace(/\/\/.*/g,"");
}
catch(e)
{
console.warn('could not read '+__dirname+"/../../settings.json")
}
//try to parse the settings //try to parse the settings
var settings; var settings;