settings: use makeAbsolute() for locating settings.json and credentials.json

This should look to consistent locations when looking for relative paths,
without depending on current working directory.
For absolute paths, nothing changes.
pull/3473/head
muxator 2018-08-22 00:01:27 +02:00 committed by muxator
parent 435b2a4edf
commit 8247d5eef3
1 changed files with 3 additions and 13 deletions

View File

@ -341,20 +341,10 @@ exports.getEpVersion = function() {
exports.reloadSettings = function reloadSettings() {
// Discover where the settings file lives
var settingsFilename = argv.settings || "settings.json";
var settingsFilename = absolutePaths.makeAbsolute(argv.settings || "settings.json");
// Discover if a credential file exists
var credentialsFilename = argv.credentials || "credentials.json";
if (path.resolve(settingsFilename)===settingsFilename) {
settingsFilename = path.resolve(settingsFilename);
} else {
settingsFilename = path.resolve(path.join(exports.root, settingsFilename));
}
if (path.resolve(credentialsFilename)===credentialsFilename) {
credentialsFilename = path.resolve(credentialsFilename);
}
var credentialsFilename = absolutePaths.makeAbsolute(argv.credentials || "credentials.json");
var settingsStr, credentialsStr;
try{