Skip to content

Commit

Permalink
check if dirs actually exist before trying to create them
Browse files Browse the repository at this point in the history
  • Loading branch information
octoocto1 committed May 19, 2016
1 parent 93b3cdd commit 400559a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions agent/routes/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ function SaveToCache(fullPath,target_path){
var i;
for(i=1;i<6;i++){
if(fs.existsSync(cacheDir + dirName + "_cache/v"+i+"/") == false){
if(i == 1) fs.mkdirSync(cacheDir + dirName+"_cache");
fs.mkdirSync(cacheDir + dirName + "_cache/v"+i);
if(i == 1) if(!fs.existsSync(cacheDir + dirName+"_cache")) fs.mkdirSync(cacheDir + dirName+"_cache");
if(!fs.existsSync(cacheDir + dirName + "_cache/v"+i)) fs.mkdirSync(cacheDir + dirName + "_cache/v"+i);
copyFile(target_path,cacheDir + dirName + "_cache/v"+i+"/"+fileName,function(){
StoreMD5(cacheDir + dirName + "_cache/v"+i+"/"+fileName,cacheDir + dirName + "_cache/v"+i+"/md5.txt");
});
Expand Down

0 comments on commit 400559a

Please sign in to comment.