diff --git a/lib/macos.js b/lib/macos.js index 7110488..d5ed5eb 100644 --- a/lib/macos.js +++ b/lib/macos.js @@ -2,11 +2,20 @@ import path from 'node:path'; import {promisify} from 'node:util'; import childProcess from 'node:child_process'; import {fileURLToPath} from 'node:url'; +import process from 'node:process'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const execFile = promisify(childProcess.execFile); -const binary = path.join(__dirname, '../main'); + +let binary = path.join(__dirname, '../main'); + +// Detect if running in packaged mode using process.resourcesPath +const isPackaged = process.resourcesPath !== process.cwd(); + +if (isPackaged) { + binary = path.join(process.resourcesPath, 'app.asar.unpacked','node_modules', 'get-windows', 'main'); +} const parseMac = stdout => { try {