fix: chemin stable pour AppImage, desktop entry permanent après install initiale

This commit is contained in:
s
2026-06-30 11:55:04 +02:00
parent 2760ab4897
commit 34ed92a647
2 changed files with 34 additions and 19 deletions

12
main.js
View File

@@ -153,9 +153,15 @@ async function downloadAndInstall(downloadUrl, version) {
sendUpdateProgress(100, 'installing');
if (process.platform === 'linux') {
fs.chmodSync(tmpPath, 0o755);
const current = process.env.APPIMAGE;
if (current) { fs.copyFileSync(tmpPath, current); fs.unlinkSync(tmpPath); app.relaunch(); }
else app.relaunch({ execPath: tmpPath });
const stablePath = path.join(require('os').homedir(), '.local', 'bin', 'farm-tracker.AppImage');
const target = fs.existsSync(stablePath) ? stablePath : process.env.APPIMAGE;
if (target) {
fs.copyFileSync(tmpPath, target);
fs.unlinkSync(tmpPath);
app.relaunch({ execPath: target });
} else {
app.relaunch({ execPath: tmpPath });
}
app.exit(0);
} else if (process.platform === 'win32') {
const { spawn } = require('child_process');