Skip to content

Commit 620c918

Browse files
MrScriptyclaude
andcommitted
fix: use writable data root for AppImage and packaged builds
AppImage mounts process.resourcesPath as read-only squashfs, causing all cache/metadata writes to fail. Use a portable data directory next to the AppImage file instead, and auto-create the directory structure on first run. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5d2c7e8 commit 620c918

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

electron/src/main.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,18 @@ async function initializeBackend(): Promise<void> {
202202
? path.join(process.resourcesPath, binaryName)
203203
: path.join(__dirname, '..', '..', 'rust', 'target', 'release', binaryName);
204204

205-
const launcherRoot = app.isPackaged
206-
? process.resourcesPath
207-
: path.join(__dirname, '..', '..');
205+
// Data root: portable (next to AppImage) or project root in dev
206+
let launcherRoot: string;
207+
if (process.env.APPIMAGE) {
208+
// AppImage: store data next to the .AppImage file
209+
launcherRoot = path.join(path.dirname(process.env.APPIMAGE), 'pumas-data');
210+
} else if (app.isPackaged) {
211+
// Other packaged formats (.deb, etc.): use standard user data path
212+
launcherRoot = app.getPath('userData');
213+
} else {
214+
// Development mode: project root
215+
launcherRoot = path.join(__dirname, '..', '..');
216+
}
208217

209218
pythonBridge = new PythonBridge({
210219
port: 0,

rust/crates/pumas-rpc/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ async fn main() -> Result<()> {
8080
info!("Launcher root: {}", launcher_root.display());
8181

8282
// Create the core API instance (model library, system utilities)
83-
let api = pumas_library::PumasApi::new(&launcher_root).await?;
83+
// Use builder with auto_create_dirs so first-run (e.g. portable AppImage)
84+
// creates the directory structure automatically.
85+
let api = pumas_library::PumasApi::builder(&launcher_root)
86+
.auto_create_dirs(true)
87+
.build()
88+
.await?;
8489

8590
// Initialize version managers for all supported apps
8691
let mut version_managers: HashMap<String, VersionManager> = HashMap::new();

0 commit comments

Comments
 (0)