Skip to content

Commit 2b08004

Browse files
committed
chore: add electron install location identifier apis for auto updater
1 parent afee19f commit 2b08004

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

src-electron/main.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,28 @@ ipcMain.handle('is-packaged', (event) => {
253253
return app.isPackaged;
254254
});
255255

256-
// Get executable path (path to the AppImage on Linux)
256+
// Path to the running Electron binary. On Linux AppImages this is the
257+
// FUSE-mounted binary (/tmp/.mount_*/...), not the .AppImage file —
258+
// use 'get-installed-app-path' if you need the user-visible install path.
257259
ipcMain.handle('get-executable-path', (event) => {
258260
assertTrusted(event);
259261
return process.execPath;
260262
});
261263

264+
// Path of the installed app, or null if not running from an installed build.
265+
// - Linux AppImage: process.env.APPIMAGE (set by AppRun to the .AppImage path)
266+
// - Other / dev / unpacked: null (auto-update not supported yet)
267+
ipcMain.handle('get-installed-app-path', (event) => {
268+
assertTrusted(event);
269+
if (!app.isPackaged) {
270+
return null;
271+
}
272+
if (process.platform === 'linux') {
273+
return process.env.APPIMAGE || null;
274+
}
275+
return null;
276+
});
277+
262278
// Update scheduled state - shared across windows for multi-window update persistence
263279
ipcMain.handle('set-update-scheduled', (event, scheduled) => {
264280
assertTrusted(event);

src-electron/preload.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
173173
getAppVersion: () => ipcRenderer.invoke('get-app-version'),
174174
isPackaged: () => ipcRenderer.invoke('is-packaged'),
175175
getExecutablePath: () => ipcRenderer.invoke('get-executable-path'),
176+
getInstalledAppPath: () => ipcRenderer.invoke('get-installed-app-path'),
176177
setUpdateScheduled: (scheduled) => ipcRenderer.invoke('set-update-scheduled', scheduled),
177178
getUpdateScheduled: () => ipcRenderer.invoke('get-update-scheduled')
178179
});

0 commit comments

Comments
 (0)