Fix an error when initializing the cache (#1788)

* Fix a error when initializing the cache

* Make context directory if it is not there  in initialization
This commit is contained in:
Hiroki Uchikawa 2018-07-10 20:41:16 +09:00 committed by Nick O'Leary
parent 407e16e900
commit 1bf4addf63
1 changed files with 7 additions and 1 deletions

View File

@ -143,7 +143,13 @@ LocalFileSystem.prototype.open = function(){
self.cache.set(scope,key,data[key]);
})
});
})
}).catch(function(err){
if(err.code == 'ENOENT') {
return fs.mkdir(self.storageBaseDir);
}else{
return Promise.reject(err);
}
});
} else {
return Promise.resolve();
}