fix: issue with second instance startup

This commit is contained in:
Igor Gassmann 2018-03-22 11:55:11 -04:00
parent fcdb935687
commit 99828d048e

View file

@ -228,27 +228,29 @@ process.on('uncaughtException', error => {
// Force single instance application
const isSecondInstance = app.makeSingleInstance(argv => {
if (
(process.platform === 'win32' || process.platform === 'linux') &&
String(argv[1]).startsWith('lbry')
) {
let URI = argv[1];
if (rendererWindow) {
if (
(process.platform === 'win32' || process.platform === 'linux') &&
String(argv[1]).startsWith('lbry')
) {
let URI = argv[1];
// Keep only command line / deep linked arguments
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
// restore the original URI that was typed.
// - If the URI has no path, Windows adds a trailing slash. LBRY URIs can't have a slash with no
// path, so we just strip it off.
// - In a URI with a claim ID, like lbry://channel#claimid, Windows interprets the hash mark as
// an anchor and converts it to lbry://channel/#claimid. We remove the slash here as well.
if (process.platform === 'win32') {
URI = URI.replace(/\/$/, '').replace('/#', '#');
// Keep only command line / deep linked arguments
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
// restore the original URI that was typed.
// - If the URI has no path, Windows adds a trailing slash. LBRY URIs can't have a slash with no
// path, so we just strip it off.
// - In a URI with a claim ID, like lbry://channel#claimid, Windows interprets the hash mark as
// an anchor and converts it to lbry://channel/#claimid. We remove the slash here as well.
if (process.platform === 'win32') {
URI = URI.replace(/\/$/, '').replace('/#', '#');
}
rendererWindow.webContents.send('open-uri-requested', URI);
}
rendererWindow.webContents.send('open-uri-requested', URI);
rendererWindow.show();
}
rendererWindow.show();
});
if (isSecondInstance) {