* Fix ~ and config.hjson lookup on Windows

This commit is contained in:
Bryan Ashby 2015-11-21 13:29:24 -07:00
parent 3ad43c07e8
commit 97ac37deb9
2 changed files with 9 additions and 15 deletions

View File

@ -47,26 +47,19 @@ function bbsMain() {
// If the user supplied a path and we can't read/parse it // If the user supplied a path and we can't read/parse it
// then it's a fatal error // then it's a fatal error
// //
console.log(err)
if(err) { if(err) {
if('ENOENT' === err.code) { if('ENOENT' === err.code) {
if(configPathSupplied) {
console.error('Configuration file does not exist: ' + configPath); console.error('Configuration file does not exist: ' + configPath);
} else {
configPathSupplied = null; // make non-fatal; we'll go with defaults
}
} else { } else {
console.error(err.toString()); console.error(err.toString());
} }
} }
callback(err); callback(err);
/*
if(configPathSupplied && err) {
if('ENOENT' === err.code) {
console.error('Configuration file does not exist: ' + configPath);
} else {
console.error('Failed parsing configuration: ' + configPath);
}
callback(err);
} else {
callback(null);
}
*/
}); });
}, },
function initSystem(callback) { function initSystem(callback) {

View File

@ -23,7 +23,8 @@ function valueWithDefault(val, defVal) {
function resolvePath(path) { function resolvePath(path) {
if(path.substr(0, 2) === '~/') { if(path.substr(0, 2) === '~/') {
path = (process.env.HOME || process.env.HOMEPATH || process.env.HOMEDIR || process.cwd()) + path.substr(1); var mswCombined = process.env.HOMEDRIVE + process.env.HOMEPATH;
path = (process.env.HOME || mswCombined || process.env.HOMEPATH || process.env.HOMEDIR || process.cwd()) + path.substr(1);
} }
return paths.resolve(path); return paths.resolve(path);
} }