Skip to content

Commit 422a106

Browse files
committed
Electron - Fixed an issue where app was displaying entries not in the same directory
1 parent 7128137 commit 422a106

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

electron/app.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@
230230
231231
if (!cache) {
232232
file_path = await openDialog();
233+
if (!file_path) throw new Error('No file path selected.');
233234
await window.ipcRenderer.invoke(
234235
'update-recent-directories',
235236
file_path
@@ -255,6 +256,7 @@
255256
}
256257
257258
const db_entries: Entry[] = await fetchEntries();
259+
console.log('DB Entries:', db_entries);
258260
const entry_map = new Map<number, TagStackImageData>();
259261
for (const entry of db_entries) {
260262
const filename = entry.filename;
@@ -268,7 +270,7 @@
268270
);
269271
if (image) {
270272
entry_map.set(entry.id, image);
271-
} else {
273+
} else if (file_path === directory) {
272274
entry_map.set(entry.id, {
273275
id: entry.id,
274276
url: '',
@@ -286,7 +288,6 @@
286288
);
287289
}
288290
}
289-
290291
const ordered_image_data = db_entries
291292
.map((entry) => entry_map.get(entry.id))
292293
.filter((image): image is TagStackImageData => !!image);

electron/dist-electron/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

electron/electron/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ function getMostRecentDirectory(): string {
125125
'userData'
126126
)}/db/recent_directories.json`;
127127

128+
if (!fs.existsSync(`${app.getPath('userData')}/db`))
129+
fs.mkdirSync(`${app.getPath('userData')}/db`);
128130
if (!fs.existsSync(recent_directories_path))
129131
fs.writeFileSync(recent_directories_path, '[]');
130132

0 commit comments

Comments
 (0)