Skip to content

Commit 0d231f3

Browse files
committed
Show error when open file fails
1 parent fa3fd8a commit 0d231f3

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/components/tables/filetreetable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,13 @@ export function FileTreeTable(props: FileTreeTableProps) {
207207
if (props.downloadDir === undefined || props.downloadDir === "") return;
208208
let path = `${props.downloadDir}/${row.fullpath}`;
209209
path = pathMapFromServer(path, serverConfig);
210-
invoke("shell_open", { path }).catch((e) => { console.error("Error opening", path, e); });
210+
invoke("shell_open", { path }).catch((e) => {
211+
notifications.show({
212+
title: "Error opening path",
213+
message: path,
214+
color: "red",
215+
});
216+
});
211217
}, [props.downloadDir, serverConfig]);
212218

213219
const [info, setInfo, handler] = useContextMenu();

src/components/tables/torrenttable.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,19 @@ export function TorrentTable(props: {
313313

314314
const onRowDoubleClick = useCallback((torrent: Torrent) => {
315315
if (torrent.downloadDir === undefined || torrent.downloadDir === "") return;
316-
let path = `${torrent.downloadDir as string}/${torrent.name as string}`;
316+
let path = torrent.downloadDir as string;
317+
if (!path.endsWith("/") && !path.endsWith("\\")) {
318+
path = path + "/";
319+
}
320+
path = path + (torrent.name as string);
317321
path = pathMapFromServer(path, serverConfig);
318-
invoke("shell_open", { path }).catch((e) => { console.error("Error opening", path, e); });
322+
invoke("shell_open", { path }).catch((e) => {
323+
notifications.show({
324+
title: "Error opening path",
325+
message: path,
326+
color: "red",
327+
});
328+
});
319329
}, [serverConfig]);
320330

321331
const [info, setInfo, handler] = useContextMenu();

0 commit comments

Comments
 (0)