mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -474,6 +474,12 @@ async function startServer(): Promise<void> {
|
||||
? 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<void> {
|
||||
...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!,
|
||||
|
||||
Reference in New Issue
Block a user