Fix overriding home folder
This commit is contained in:
parent
d725bf0f70
commit
dcec9f3c37
@ -12,9 +12,8 @@ program.option("");
|
||||
program.option(" --home <path>" , "home path");
|
||||
|
||||
var argv = program.parseOptions(process.argv);
|
||||
if (program.home) {
|
||||
Helper.HOME = path.resolve(program.home);
|
||||
}
|
||||
|
||||
Helper.setHome(program.home);
|
||||
|
||||
if (!fs.existsSync(Helper.CONFIG_PATH)) {
|
||||
mkdirp.sync(Helper.HOME, {mode: "0700"});
|
||||
|
@ -1,17 +1,21 @@
|
||||
var path = require("path");
|
||||
var os = require("os");
|
||||
|
||||
var HOME = expandHome("~/.lounge");
|
||||
|
||||
module.exports = {
|
||||
HOME: HOME,
|
||||
CONFIG_PATH: path.join(HOME, "config.js"),
|
||||
USERS_PATH: path.join(HOME, "users"),
|
||||
var Helper = {
|
||||
expandHome: expandHome,
|
||||
getConfig: getConfig,
|
||||
getUserConfigPath: getUserConfigPath,
|
||||
setHome: setHome,
|
||||
};
|
||||
|
||||
module.exports = Helper;
|
||||
|
||||
function setHome(homePath) {
|
||||
this.HOME = expandHome(homePath || "~/.lounge");
|
||||
this.CONFIG_PATH = path.join(this.HOME, "config.js");
|
||||
this.USERS_PATH = path.join(this.HOME, "users");
|
||||
}
|
||||
|
||||
function getUserConfigPath(name) {
|
||||
return path.join(this.USERS_PATH, name + ".json");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user