From 35481fe7d792fa1ea4b826b325214cc529ff74f4 Mon Sep 17 00:00:00 2001 From: s Date: Tue, 30 Jun 2026 12:45:37 +0200 Subject: [PATCH] fix: update Linux via spawn comme Windows (plus app.relaunch) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit app.relaunch() ne fonctionne pas avec les AppImages — il tente de relancer le binaire Electron interne au lieu du fichier .AppImage. On utilise maintenant spawn + detach + app.quit() comme sur Windows. selfInstallLinux() gère la copie vers ~/.local/bin/ au premier démarrage du nouvel AppImage. Co-Authored-By: Claude Sonnet 4.6 --- main.js | 22 +++------------------- package.json | 2 +- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/main.js b/main.js index 5cf8f90..c8fb7eb 100644 --- a/main.js +++ b/main.js @@ -153,25 +153,9 @@ async function downloadAndInstall(downloadUrl, version) { sendUpdateProgress(100, 'installing'); if (process.platform === 'linux') { fs.chmodSync(tmpPath, 0o755); - const stablePath = path.join(require('os').homedir(), '.local', 'bin', 'farm-tracker.AppImage'); - try { - fs.mkdirSync(path.dirname(stablePath), { recursive: true }); - fs.copyFileSync(tmpPath, stablePath); - fs.chmodSync(stablePath, 0o755); - fs.unlinkSync(tmpPath); - app.relaunch({ execPath: stablePath }); - } catch (_) { - // fallback: remplace l'AppImage courant si la copie vers bin/ échoue - const fallback = process.env.APPIMAGE; - if (fallback) { - fs.copyFileSync(tmpPath, fallback); - fs.unlinkSync(tmpPath); - app.relaunch({ execPath: fallback }); - } else { - app.relaunch({ execPath: tmpPath }); - } - } - app.exit(0); + const { spawn } = require('child_process'); + spawn(tmpPath, [], { detached: true, stdio: 'ignore' }).unref(); + app.quit(); } else if (process.platform === 'win32') { const { spawn } = require('child_process'); spawn(tmpPath, ['/S'], { detached: true, stdio: 'ignore' }).unref(); diff --git a/package.json b/package.json index c188317..de28289 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "farm-tracker", - "version": "1.0.5", + "version": "1.0.7", "description": "Suivi de loot Minecraft en direct, avec sauvegarde automatique des stats et des chances de drop.", "main": "main.js", "scripts": {