diff --git a/desktop/main.js b/desktop/main.js index 6e0fed8..2fe5089 100644 --- a/desktop/main.js +++ b/desktop/main.js @@ -61,10 +61,14 @@ function snoreExe() { try { const dir = path.dirname(require.resolve('node-notifier')); const exe = os.arch() === 'ia32' ? 'snoretoast-x86.exe' : 'snoretoast-x64.exe'; - const base = path.join(dir, 'vendor', 'snoreToast', exe); - for (const c of [base, base.replace('app.asar' + path.sep, 'app.asar.unpacked' + path.sep)]) { - if (fs.existsSync(c)) return c; + let p = path.join(dir, 'vendor', 'snoreToast', exe); + // In a packaged app the module resolves inside app.asar, but binaries live in + // app.asar.unpacked — and fs.existsSync falsely reports the asar path exists, so we can't + // test it; map to the unpacked copy unconditionally (that's the real, spawnable file). + if (p.includes('app.asar' + path.sep) && !p.includes('app.asar.unpacked')) { + p = p.replace('app.asar' + path.sep, 'app.asar.unpacked' + path.sep); } + return p; } catch (_) {} return null; }