Fix creation of cache directory

This commit is contained in:
Casper Warden
2017-12-20 18:10:18 +00:00
parent 4f02dd6a2a
commit 3ef4285b14
3 changed files with 8 additions and 3 deletions

View File

@@ -30,7 +30,12 @@ export class InventoryFolder
{
this.agent = agent;
this.inventoryBase = invBase;
this.cacheDir = path.resolve(__dirname + '/cache/' + this.agent.agentID.toString());
const cacheLocation = path.resolve(__dirname + '/cache');
if (!fs.existsSync(cacheLocation))
{
fs.mkdirSync(cacheLocation, 0o777);
}
this.cacheDir = path.resolve(cacheLocation + '/' + this.agent.agentID.toString());
if (!fs.existsSync(this.cacheDir))
{
fs.mkdirSync(this.cacheDir, 0o777);