|
|
@ -373,9 +373,13 @@ class Persistence { |
|
|
|
* @private |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static async ensureDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) { |
|
|
|
static async ensureDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) { |
|
|
|
|
|
|
|
const parsedDir = path.parse(path.resolve(dir)) |
|
|
|
|
|
|
|
// this is because on Windows mkdir throws a permission error when called on the root directory of a volume
|
|
|
|
|
|
|
|
if (process.platform !== 'win32' || parsedDir.dir !== parsedDir.root) { |
|
|
|
await storage.mkdirAsync(dir, { recursive: true, mode }) |
|
|
|
await storage.mkdirAsync(dir, { recursive: true, mode }) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Interface
|
|
|
|
// Interface
|
|
|
|
module.exports = Persistence |
|
|
|
module.exports = Persistence |
|
|
|