diff --git a/src/main/index.ts b/src/main/index.ts index 5300403..e3e52f8 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -326,7 +326,22 @@ app.whenReady().then(async () => { optimizer.watchWindowShortcuts(window); }); - const isDefaultProtocolClient = app.setAsDefaultProtocolClient(protocol); + let isDefaultProtocolClient; + // remove so we can register each time as we run the app. + app.removeAsDefaultProtocolClient(protocol); + + // If we are running a non-packaged version of the app && on windows + if (process.env.NODE_ENV === "development" && process.platform === "win32") { + // Set the path of electron.exe and your app. + // These two additional parameters are only available on windows. + isDefaultProtocolClient = app.setAsDefaultProtocolClient( + protocol, + process.execPath, + [path.resolve(process.argv[1])], + ); + } else { + isDefaultProtocolClient = app.setAsDefaultProtocolClient(protocol); + } if (isDefaultProtocolClient) { log.info("Protocol handler registered successfully."); } else { @@ -487,6 +502,6 @@ function openMainWindow(): void { function openInExplorer(url: string): void { const folderPath: string = decodeURIComponent(url.split(`${protocol}://`)[1]); - log.info("Opening folder in explorer", path.dirname(folderPath)); - shell.openPath(path.dirname(folderPath)); + log.info("Opening folder in explorer", folderPath); + shell.openPath(folderPath); }