save map config to local file

This commit is contained in:
OttoMao
2015-08-06 17:26:22 +08:00
parent ef19ccf72b
commit edaf638f3c
4 changed files with 69 additions and 4 deletions

View File

@@ -21,9 +21,25 @@ module.exports.merge = function(baseObj, extendObj){
return baseObj;
}
module.exports.getUserHome = function(){
function getUserHome(){
return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
}
module.exports.getUserHome = getUserHome;
module.exports.getAnyProxyHome = function(){
var home = path.join(util.getUserHome(),"/.anyproxy/");
if(!fs.existsSync(home)){
try{
fs.mkdirSync(home,0777);
}catch(e){
return null;
}
}
return home;
}
module.exports.simpleRender = function(str, object, regexp){
return String(str).replace(regexp || (/\{\{([^{}]+)\}\}/g), function(match, name){