Skip to content

Commit

Permalink
Fix Windows file launch
Browse files Browse the repository at this point in the history
  • Loading branch information
HieronymusLex authored Oct 19, 2020
1 parent 7b2aba4 commit 590999d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/desktop/public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,23 @@ const handleNavigate = (event, url) => {

const hasValidExtension = fp => fp.endsWith(".range") || fp.endsWith(".json");

const parseFileArgs = args => args.filter(fp => {
return fp.substring(0, 2) !== '--' && hasValidExtension(fp) && fs.existsSync(fp);
});

if (!app.requestSingleInstanceLock()) {
app.quit()
} else {
let files = parseFileArgs(process.argv);
!isMac && files.forEach(fp => initOpenFileQueue.push(fp));

app.on('second-instance', (event, argv, workingDirectory) => {
// Someone tried to run a second instance, we should focus our window and load any ranges that triggered the app.
if (appWindow) {
if (appWindow.isMinimized()) appWindow.restore();
appWindow.focus();
let args = argv.slice(isDev ? 2 : 1);
let files = args.filter(fp => {
return fp.substring(0, 2) !== '--' && hasValidExtension(fp) && fs.existsSync(fp);
});
let files = parseFileArgs(args);
!isMac && files.forEach(handleRange);
}
});
Expand Down

0 comments on commit 590999d

Please sign in to comment.