mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-30 08:51:24 +00:00
fix: issue with second instance startup
This commit is contained in:
parent
fcdb935687
commit
99828d048e
1 changed files with 19 additions and 17 deletions
|
@ -228,27 +228,29 @@ process.on('uncaughtException', error => {
|
||||||
|
|
||||||
// Force single instance application
|
// Force single instance application
|
||||||
const isSecondInstance = app.makeSingleInstance(argv => {
|
const isSecondInstance = app.makeSingleInstance(argv => {
|
||||||
if (
|
if (rendererWindow) {
|
||||||
(process.platform === 'win32' || process.platform === 'linux') &&
|
if (
|
||||||
String(argv[1]).startsWith('lbry')
|
(process.platform === 'win32' || process.platform === 'linux') &&
|
||||||
) {
|
String(argv[1]).startsWith('lbry')
|
||||||
let URI = argv[1];
|
) {
|
||||||
|
let URI = argv[1];
|
||||||
|
|
||||||
// Keep only command line / deep linked arguments
|
// Keep only command line / deep linked arguments
|
||||||
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
// Windows normalizes URIs when they're passed in from other apps. On Windows, this tries to
|
||||||
// restore the original URI that was typed.
|
// 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
|
// - 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.
|
// path, so we just strip it off.
|
||||||
// - In a URI with a claim ID, like lbry://channel#claimid, Windows interprets the hash mark as
|
// - 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.
|
// an anchor and converts it to lbry://channel/#claimid. We remove the slash here as well.
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
URI = URI.replace(/\/$/, '').replace('/#', '#');
|
URI = URI.replace(/\/$/, '').replace('/#', '#');
|
||||||
|
}
|
||||||
|
|
||||||
|
rendererWindow.webContents.send('open-uri-requested', URI);
|
||||||
}
|
}
|
||||||
|
|
||||||
rendererWindow.webContents.send('open-uri-requested', URI);
|
rendererWindow.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
rendererWindow.show();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isSecondInstance) {
|
if (isSecondInstance) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue