From c8a6da582a7e48fea17cf3f3598537b6c1392744 Mon Sep 17 00:00:00 2001 From: Aeon Date: Tue, 17 Feb 2026 19:19:42 +0100 Subject: [PATCH] Move custom_main.js handling to execute before checking command line switches --- src/ElectronNET.Host/main.js | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ElectronNET.Host/main.js b/src/ElectronNET.Host/main.js index 9ea21ded..297f5e19 100644 --- a/src/ElectronNET.Host/main.js +++ b/src/ElectronNET.Host/main.js @@ -24,26 +24,6 @@ let unpackeddotnet = false; let dotnetpacked = false; let electronforcedport; -if (app.commandLine.hasSwitch('manifest')) { - manifestJsonFileName = app.commandLine.getSwitchValue('manifest'); -} - -console.log('Entry!!!: '); - -if (app.commandLine.hasSwitch('unpackedelectron')) { - unpackedelectron = true; -} -else if (app.commandLine.hasSwitch('unpackeddotnet')) { - unpackeddotnet = true; -} -else if (app.commandLine.hasSwitch('dotnetpacked')) { - dotnetpacked = true; -} - -if (app.commandLine.hasSwitch('electronforcedport')) { - electronforcedport = app.commandLine.getSwitchValue('electronforcedport'); -} - // Custom startup hook: look for custom_main.js and invoke its onStartup(host) if present. // If the hook returns false, abort Electron startup. try { @@ -67,6 +47,26 @@ try { console.error('Error while executing custom_main.js:', err); } +if (app.commandLine.hasSwitch('manifest')) { + manifestJsonFileName = app.commandLine.getSwitchValue('manifest'); +} + +console.log('Entry!!!: '); + +if (app.commandLine.hasSwitch('unpackedelectron')) { + unpackedelectron = true; +} +else if (app.commandLine.hasSwitch('unpackeddotnet')) { + unpackeddotnet = true; +} +else if (app.commandLine.hasSwitch('dotnetpacked')) { + dotnetpacked = true; +} + +if (app.commandLine.hasSwitch('electronforcedport')) { + electronforcedport = app.commandLine.getSwitchValue('electronforcedport'); +} + const currentPath = __dirname; let currentBinPath = path.join(currentPath.replace('app.asar', ''), 'bin'); let manifestJsonFilePath = path.join(currentPath, manifestJsonFileName);