Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #348 from subspace/fix/update-default-plot-directory
Browse files Browse the repository at this point in the history
Fix/update default plot directory
  • Loading branch information
dnoishi authored Sep 29, 2022
2 parents 4d3a8e8 + 52fa88f commit fece3dd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/mainMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default defineComponent({
try {
const log_path = await util.getLogPath();
util.infoLogger('log path acquired:' + log_path);
await tauri.invoke("open_folder", {dir: log_path});
await tauri.invoke('open_folder', {dir: log_path});
} catch (error) {
// TODO: add proper error handling - update store and show error page
util.errorLogger(error);
Expand Down
1 change: 1 addition & 0 deletions src/lib/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export {
PIECE_SIZE,
GB,
CONTEXT_MENU,
PLOT_FOLDER,
createApi,
generateNodeName,
getErrorMessage,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,5 @@ export function getErrorMessage(error: unknown): string | undefined {
return;
}
}

export const PLOT_FOLDER = '/plots';
10 changes: 8 additions & 2 deletions src/pages/SetupPlot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ export default defineComponent({
},
async mounted() {
await this.updateDriveStats();
const path = (await tauri.path.dataDir()) + util.appName;
const path = (await tauri.path.dataDir()) + util.appName + util.PLOT_FOLDER;
this.store.setPlotPath(path);
await this.createDefaultPlotDir();
},
async created() {
this.$watch(
Expand Down Expand Up @@ -259,7 +260,7 @@ export default defineComponent({
if (files) {
console.log('FILES ARE: :', files);
if (files.length === 0 || (files.length === 1 && files.some(item => item.name === 'subspace-desktop.cfg'))) {
if (files.length === 0) {
directoryDialogs.existingDirectoryConfirm(this.store.plotPath, this.startPlotting);
// we are in FIRST TIME START, meaning there is are no existing plot
// if there are some files in this folder, it's weird
Expand Down Expand Up @@ -303,6 +304,11 @@ export default defineComponent({
}
await this.updateDriveStats();
},
async createDefaultPlotDir() {
await tauri.fs.createDir(this.store.plotPath).catch((error) => {
util.errorLogger(error);
});
},
}
});
</script>
Expand Down
6 changes: 3 additions & 3 deletions src/shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Mocks all files ending in `.vue` showing them as plain Vue instances
declare module '*.vue' {
import { ComponentOptions } from 'vue'
const component: ComponentOptions
export default component
import { ComponentOptions } from 'vue';
const component: ComponentOptions;
export default component;
}

0 comments on commit fece3dd

Please sign in to comment.