diff --git a/apps/stage-tamagotchi/electron-builder.config.ts b/apps/stage-tamagotchi/electron-builder.config.ts index 342dc75d5e..f083d87d38 100644 --- a/apps/stage-tamagotchi/electron-builder.config.ts +++ b/apps/stage-tamagotchi/electron-builder.config.ts @@ -132,6 +132,7 @@ export default { deleteAppDataOnUninstall: true, oneClick: false, allowToChangeInstallationDirectory: true, + runAfterFinish: true, }, mac: { entitlementsInherit: 'build/entitlements.mac.plist', diff --git a/apps/stage-tamagotchi/src/main/index.ts b/apps/stage-tamagotchi/src/main/index.ts index e87403f591..3af552e6fe 100644 --- a/apps/stage-tamagotchi/src/main/index.ts +++ b/apps/stage-tamagotchi/src/main/index.ts @@ -322,12 +322,20 @@ async function handleAppExit() { skipFileLogging = true await logIfError('flush file logs', () => fileLogger.close()) // Ensure all logs are flushed - app.exit(exitedNormally ? 0 : 1) + if (!exitedNormally) { + app.exit(1) + } + else { + app.quit() + } } process.on('SIGINT', () => handleAppExit()) app.on('before-quit', (event) => { + if (appExiting) + return + event.preventDefault() handleAppExit() }) diff --git a/apps/stage-tamagotchi/src/main/services/electron/auto-updater.ts b/apps/stage-tamagotchi/src/main/services/electron/auto-updater.ts index dfb44b49f8..4445989b92 100644 --- a/apps/stage-tamagotchi/src/main/services/electron/auto-updater.ts +++ b/apps/stage-tamagotchi/src/main/services/electron/auto-updater.ts @@ -47,7 +47,14 @@ function getCacheRoot() { } function getLegacyCacheRoot() { - return getCacheRoot() + switch (process.platform) { + case 'win32': + return process.env.LOCALAPPDATA || join(process.env.USERPROFILE || '', 'AppData', 'Local') + case 'darwin': + return join(process.env.HOME || '', 'Library', 'Caches') + default: + return process.env.XDG_CACHE_HOME || join(process.env.HOME || '', '.cache') + } } const UPDATER_DEBUG_CACHE_DIR = join(getCacheRoot(), 'stage-tamagotchi-updater')