Shuo/src/helper.js

23 lines
500 B
JavaScript
Raw Normal View History

var path = require("path");
var Helper = module.exports = {
2014-09-13 17:10:32 +00:00
getConfig: function () {
return require(path.resolve(__dirname, "..", "config"));
},
2014-09-13 17:10:32 +00:00
getHomeDirectory: function () {
return (
this.getConfig().home
|| process.env.SHOUT_HOME
|| path.resolve(process.env.HOME, ".shout")
);
},
2014-09-13 17:10:32 +00:00
resolveHomePath: function () {
var fragments = [ Helper.HOME ].concat([].slice.apply(arguments));
return path.resolve.apply(path, fragments);
}
};
Helper.HOME = Helper.getHomeDirectory()