diff --git a/README.md b/README.md index c6d4bc10..3c844d1b 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ yarn download-binaries yarn test:e2e ``` -The launch sets `RAXMLGUI_E2E=1`. That skips auto-update checks and points the main process at the repo `static/` directory (example files, binaries, and test output). The built page loads that example alignment from the same flag. +The launch sets `RAXMLGUI_E2E=1`. That skips auto-update checks. The unpacked main process reads example files and binaries from the repo `static/` directory and writes test output there. The built page loads that example alignment from the same flag. ## Input formats diff --git a/electron.vite.config.js b/electron.vite.config.js index ef6879eb..54bbf348 100644 --- a/electron.vite.config.js +++ b/electron.vite.config.js @@ -18,10 +18,6 @@ function sourceMapUpload( command ) { export default defineConfig( ( { command } ) => ( { main: { - // electron-webpack injected this path. The main process still reads the repo's static files through it. - define: { - __static: JSON.stringify( resolve( __dirname, 'static' ) ), - }, plugins: sourceMapUpload( command ), }, preload: { diff --git a/src/__static.d.ts b/src/__static.d.ts deleted file mode 100644 index 7b81469e..00000000 --- a/src/__static.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare const __static: string; diff --git a/src/main/processHelpers.ts b/src/main/processHelpers.ts index 78c947c8..2079a632 100644 --- a/src/main/processHelpers.ts +++ b/src/main/processHelpers.ts @@ -34,11 +34,11 @@ interface RunProcessHooks { onStdErr?: ( content: string ) => void; } +// Packaged: electron-builder's extraResources copies static/ beside the asar. Unpacked: out/main/ sits two levels below the repo root. export function getStaticDir(): string { - if ( process.env.RAXMLGUI_E2E === '1' ) { - return path.join( __dirname, '..', '..', 'static' ); - } - return __static; + return app.isPackaged + ? path.join( process.resourcesPath, 'static' ) + : path.join( __dirname, '..', '..', 'static' ); } export const get_space_safe_binary_path = ( bin_path: string ): string => {