fix(desktop): allow dev and production instances to coexist (#1155)

Dev mode now uses a separate app name ('Multica Dev') and userData path
before acquiring the single-instance lock, so the lock file no longer
collides with the packaged production app. The AppUserModelId is also
differentiated (ai.multica.desktop.dev vs ai.multica.desktop).

This follows the same pattern VS Code uses for Stable / Insiders
coexistence: isolate identity before requestSingleInstanceLock().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
LinYushen
2026-04-16 16:20:37 +08:00
committed by GitHub
parent b5ee6f2579
commit e3a1b951fb

View File

@@ -94,6 +94,18 @@ function createWindow(): void {
}
}
// --- Dev / production isolation -------------------------------------------
// Give dev mode a separate app name and userData path so it gets its own
// single-instance lock file and doesn't conflict with the packaged production
// app. Must run BEFORE requestSingleInstanceLock() because the lock location
// is derived from the userData path. (Same approach VS Code uses for
// Stable / Insiders coexistence.)
if (is.dev) {
app.setName("Multica Dev");
app.setPath("userData", join(app.getPath("appData"), "Multica Dev"));
}
// --- Protocol registration -----------------------------------------------
if (process.defaultApp) {
@@ -125,7 +137,9 @@ if (!gotTheLock) {
});
app.whenReady().then(() => {
electronApp.setAppUserModelId("ai.multica.desktop");
electronApp.setAppUserModelId(
is.dev ? "ai.multica.desktop.dev" : "ai.multica.desktop",
);
app.on("browser-window-created", (_, window) => {
optimizer.watchWindowShortcuts(window);