X-Git-Url: http://git.pjr.cc/?p=nodejs-repoproxy.git;a=blobdiff_plain;f=lib%2Fconfig.js;h=441caedc6a427a9757932ed321be9cfd2a66b34c;hp=dd13be4da4478ac844938be415b20df78009d0d6;hb=d9c7eb8248208029df200a897d680914cd0f337f;hpb=c3e6676d533e875b020d231075aac04e4b885677 diff --git a/lib/config.js b/lib/config.js index dd13be4..441caed 100644 --- a/lib/config.js +++ b/lib/config.js @@ -33,9 +33,9 @@ exports.loadConfig = function (conffile) { break; case "cachedir": - console.log("Cache dir set to: ", line_real[1]); - global.repoproxy.cacheDir = line_real[1]; - + var tmppath = line_real[1].replace(/\/+/g, "/"); + console.log("Cache dir set to: ", tmppath); + global.repoproxy.cacheDir = tmppath; break; case "listenport": console.log("Port set to: ", line_real[1]); @@ -67,11 +67,18 @@ function createCacheStructure() { } catch(e) { try { fs.mkdirSync(global.repoproxy.cacheDir); + fs.mkdirSync(global.repoproxy.cacheDir + "/.cleanup"); } catch(ex) { console.log("ERROR: failure to create cache directory, '%s'", global.repoproxy.cacheDir); } } + try { + fs.mkdirSync(global.repoproxy.cacheDir + "/.cleanup"); + } catch(ex) { + console.log("ERROR: cant create cleanup directory, '%s'", global.repoproxy.cacheDir + "/.cleanup"); + } + for(var index in global.repoproxy.repo) { var fullDir = global.repoproxy.cacheDir + "/" + index; try {