Skip to content

Commit

Permalink
Merge pull request #1314 from ebkr/data-folder-error-handling
Browse files Browse the repository at this point in the history
Handle errors while changing the data folder
  • Loading branch information
anttimaki authored May 6, 2024
2 parents 4cd8d14 + 2aea5bb commit 6f44582
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/pages/Manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,9 @@ import CategoryFilterModal from '../components/modals/CategoryFilterModal.vue';
const isDefaultDataDirectory = files[0] === PathResolver.APPDATA_DIR;
if (hasOverrideFile || !directoryHasContents || isDefaultDataDirectory) {
await this.settings.setDataDirectory(files[0]);
// Write dataDirectoryOverrideFile to allow re-selection of directory if changed at a later point.
await fs.writeFile(path.join(files[0], dataDirectoryOverrideFile), "");
await this.settings.setDataDirectory(files[0]);
InteractionProvider.instance.restartApp();
} else {
this.$store.commit('error/handleError', new R2Error(
Expand All @@ -530,6 +530,11 @@ import CategoryFilterModal from '../components/modals/CategoryFilterModal.vue';
));
}
}
}).catch((err) => {
this.$store.commit(
"error/handleError",
R2Error.fromThrownValue(err, "Failed to change Data Folder")
);
});
}
Expand Down

0 comments on commit 6f44582

Please sign in to comment.