From a8f1f46ebee2bc884b9cfb90c5d1ede7068425d6 Mon Sep 17 00:00:00 2001 From: Maxime GRANDCOLAS Date: Thu, 13 Feb 2025 11:21:50 +0100 Subject: [PATCH] [MS] Updated how files are opened (#9682) --- client/electron/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/electron/src/index.ts b/client/electron/src/index.ts index 0d75d02d466..3bda09824df 100644 --- a/client/electron/src/index.ts +++ b/client/electron/src/index.ts @@ -180,10 +180,10 @@ ipcMain.on(PageToWindowChannel.CloseApp, async (_event) => { }); ipcMain.on(PageToWindowChannel.OpenFile, async (_event, path: string) => { - const result = await shell.openPath(path); - if (result !== '') { - myCapacitorApp.sendEvent(WindowToPageChannel.OpenPathFailed, path, result); + if (!path.startsWith('file://')) { + path = `file://${path}`; } + await shell.openExternal(path); }); ipcMain.on(PageToWindowChannel.SeeInExplorer, async (_event, path: string) => { @@ -213,7 +213,7 @@ ipcMain.on(PageToWindowChannel.PageIsInitialized, async () => { }); ipcMain.on(PageToWindowChannel.OpenConfigDir, async () => { - await shell.openPath(parsecConfigDir); + await shell.openExternal(parsecConfigDir.startsWith('file://') ? parsecConfigDir : `file://${parsecConfigDir}`); }); ipcMain.on(PageToWindowChannel.AuthorizeURL, async (_event, url: string) => {