Merge branch 'feature/IO-3066-1-scaffolding' of bitbucket.org:snaptsoft/bodyshop-desktop into feature/IO-3066-1-scaffolding

This commit is contained in:
Patrick Fic
2025-04-11 09:26:16 -07:00
9 changed files with 52 additions and 22 deletions

View File

@@ -325,7 +325,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 {
@@ -486,6 +501,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);
}