fix more properly #48 after reading path.parse documentation more thoroughly

pull/49/head
Timothée Rebours 12 months ago
parent 03217cead9
commit afe1831485
  1. 2
      lib/persistence.js

@ -375,7 +375,7 @@ class Persistence {
static async ensureDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) { static async ensureDirectoryExistsAsync (dir, mode = DEFAULT_DIR_MODE) {
const parsedDir = path.parse(path.resolve(dir)) 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 // 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) { if (process.platform !== 'win32' || parsedDir.dir !== parsedDir.root || parsedDir.base !== '') {
await storage.mkdirAsync(dir, { recursive: true, mode }) await storage.mkdirAsync(dir, { recursive: true, mode })
} }
} }

Loading…
Cancel
Save