make custom protocol handler work in dev mode

This commit is contained in:
brian91292
2023-05-23 13:51:32 -05:00
parent 5ac79f81b9
commit aa16c290ad
+13 -1
View File
@@ -621,7 +621,19 @@ function setupApp() {
app.on('activate', function() {
if (mainWindow === null) createWindow();
});
app.setAsDefaultProtocolClient('sidequest');
// remove so we can register each time as we run the app.
app.removeAsDefaultProtocolClient('sidequest');
// If we are running a non-packaged version of the app && on windows
if (process.env.NODE_ENV === 'dev' && process.platform === 'win32') {
console.log('Running in dev mode');
// Set the path of electron.exe and your app.
// These two additional parameters are only available on windows.
app.setAsDefaultProtocolClient('sidequest', process.execPath, [path.resolve(process.argv[1])]);
} else {
console.log('Running in production');
app.setAsDefaultProtocolClient('sidequest');
}
app.on('open-url', function(event, url) {
event.preventDefault();
});