only register open-url handler on macos

This commit is contained in:
Michael Telatynski 2020-03-02 16:49:55 +00:00
parent dd45008291
commit 4b8b32c3e5

View File

@ -34,14 +34,14 @@ module.exports = () => {
app.setAsDefaultProtocolClient('riot', process.execPath, [app.getAppPath(), ...args]); app.setAsDefaultProtocolClient('riot', process.execPath, [app.getAppPath(), ...args]);
} }
// Protocol handler for macos if (process.platform === 'darwin') {
app.on('open-url', function(ev, url) { // Protocol handler for macos
ev.preventDefault(); app.on('open-url', function(ev, url) {
processUrl(url); ev.preventDefault();
}); processUrl(url);
});
// Protocol handler for win32/Linux } else {
if (process.platform !== 'darwin') { // Protocol handler for win32/Linux
app.on('second-instance', (ev, commandLine) => { app.on('second-instance', (ev, commandLine) => {
const url = commandLine[commandLine.length - 1]; const url = commandLine[commandLine.length - 1];
if (!url.startsWith("riot://")) return; if (!url.startsWith("riot://")) return;