From 484d4c65d5070320d66fdd85005a258569895975 Mon Sep 17 00:00:00 2001 From: DhanushSantosh Date: Sun, 18 Jan 2026 16:25:35 +0530 Subject: [PATCH] fix: use shared data directory for Electron and web modes CRITICAL: Electron was using ~/.config/@automaker/app/data/ while web mode used ./data/, causing projects to never sync between modes. In development mode, both now use the shared project root ./data directory. In production, Electron uses its isolated userData directory for app portability. This ensures: - Electron projects sync to the same server data directory as web mode - Projects opened in Electron immediately appear in web mode - Server restart doesn't lose projects from either mode The issue was on line 487 where DATA_DIR was set to app.getPath('userData') instead of the shared project ./data directory. Fixes the fundamental problem where projects never appeared in web mode even though they were in the server's settings file. Co-Authored-By: Claude Haiku 4.5 --- apps/ui/src/main.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/ui/src/main.ts b/apps/ui/src/main.ts index 8930d664..3a7e74ca 100644 --- a/apps/ui/src/main.ts +++ b/apps/ui/src/main.ts @@ -474,6 +474,12 @@ async function startServer(): Promise { ? path.join(process.resourcesPath, 'server') : path.join(__dirname, '../../server'); + // IMPORTANT: Use shared data directory (not Electron's user data directory) + // This ensures Electron and web mode share the same settings/projects + // In dev: project root/data + // In production: same as Electron user data (for app isolation) + const dataDir = app.isPackaged ? app.getPath('userData') : path.join(__dirname, '../../../data'); + // Build enhanced PATH that includes Node.js directory (cross-platform) const enhancedPath = buildEnhancedPath(command, process.env.PATH || ''); if (enhancedPath !== process.env.PATH) { @@ -484,7 +490,7 @@ async function startServer(): Promise { ...process.env, PATH: enhancedPath, PORT: serverPort.toString(), - DATA_DIR: app.getPath('userData'), + DATA_DIR: dataDir, NODE_PATH: serverNodeModules, // Pass API key to server for CSRF protection AUTOMAKER_API_KEY: apiKey!,