* Fix ~ and config.hjson lookup on Windows
This commit is contained in:
parent
3ad43c07e8
commit
97ac37deb9
21
core/bbs.js
21
core/bbs.js
|
@ -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) {
|
||||||
console.error('Configuration file does not exist: ' + configPath);
|
if(configPathSupplied) {
|
||||||
|
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) {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
Loading…
Reference in New Issue