2014-10-04 23:22:23 +00:00
|
|
|
var path = require("path");
|
2016-04-27 08:13:25 +00:00
|
|
|
var os = require("os");
|
2014-10-04 23:22:23 +00:00
|
|
|
|
2014-10-03 23:33:44 +00:00
|
|
|
module.exports = {
|
2016-02-10 05:45:21 +00:00
|
|
|
HOME: (process.env.HOME || process.env.USERPROFILE) + "/.lounge",
|
2016-04-27 08:13:25 +00:00
|
|
|
getConfig: getConfig,
|
|
|
|
expandHome: expandHome,
|
2014-09-13 12:23:17 +00:00
|
|
|
};
|
|
|
|
|
2014-10-03 23:33:44 +00:00
|
|
|
function getConfig() {
|
2014-10-04 23:22:23 +00:00
|
|
|
return require(path.resolve(this.HOME) + "/config");
|
2015-09-30 22:39:57 +00:00
|
|
|
}
|
2016-04-27 08:13:25 +00:00
|
|
|
|
|
|
|
function expandHome(path) {
|
|
|
|
var home;
|
|
|
|
|
|
|
|
if (os.homedir) {
|
|
|
|
home = os.homedir();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!home) {
|
|
|
|
home = process.env.HOME || "";
|
|
|
|
}
|
|
|
|
|
|
|
|
home = home.replace("$", "$$$$");
|
|
|
|
|
|
|
|
return path.replace(/^~($|\/|\\)/, home + "$1");
|
|
|
|
}
|
|
|
|
|