build(electron): app now builds and runs on macOS as a standalone app
This commit is contained in:
@@ -2,8 +2,13 @@ const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron');
|
||||
const path = require('path');
|
||||
|
||||
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||
if (require('electron-squirrel-startup')) {
|
||||
app.quit();
|
||||
try {
|
||||
if (require('electron-squirrel-startup')) {
|
||||
app.quit();
|
||||
}
|
||||
} catch (error) {
|
||||
// electron-squirrel-startup is not available or not needed on this platform
|
||||
console.log('electron-squirrel-startup not available, continuing...');
|
||||
}
|
||||
|
||||
let mainWindow;
|
||||
|
||||
@@ -6,10 +6,16 @@ const { spawn } = require('child_process');
|
||||
function runPythonCommand(command, kwargs, event) {
|
||||
const buildDir = path.resolve(__dirname, '..', '..', 'build');
|
||||
let backendPath;
|
||||
|
||||
// Determine executable name based on platform
|
||||
const executableName = process.platform === 'win32' ? 'fourdst-backend.exe' : 'fourdst-backend';
|
||||
|
||||
if (app.isPackaged) {
|
||||
backendPath = path.join(process.resourcesPath, 'fourdst-backend');
|
||||
// In packaged app, backend is in resources/backend/ directory
|
||||
backendPath = path.join(process.resourcesPath, 'backend', executableName);
|
||||
} else {
|
||||
backendPath = path.join(buildDir, 'electron', 'dist', 'fourdst-backend', 'fourdst-backend');
|
||||
// In development, use the meson build output
|
||||
backendPath = path.join(buildDir, 'electron', 'dist', 'fourdst-backend', executableName);
|
||||
}
|
||||
|
||||
console.log(`[MAIN_PROCESS] Spawning backend: ${backendPath}`);
|
||||
|
||||
Reference in New Issue
Block a user