Browse Source

fix: handle non empty JSON file dir. Fixes #3311

tags/v4.7.1
Samuel Attard 1 year ago
parent
commit
931f8e595d
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      src/main/utils/_jsonCreator.js

+ 8
- 2
src/main/utils/_jsonCreator.js View File

@@ -23,8 +23,14 @@ export default function (fileName) {
}

if (fs.existsSync(OLD_PATH)) {
fs.renameSync(OLD_PATH, PATH);
fs.rmdirSync(OLD_DIR);
// Move old to new if new does not exist
if (!fs.existsSync(PATH)) {
fs.renameSync(OLD_PATH, PATH);
}
// Delete old dir if it is empty
if (fs.readdirSync(OLD_DIR).length === 0) {
fs.rmdirSync(OLD_DIR);
}
}

return PATH;


Loading…
Cancel
Save