summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgabrix73 <gabriel1@frozenstar.info>2026-04-12 17:16:08 +0200
committergabrix73 <gabriel1@frozenstar.info>2026-04-12 17:16:08 +0200
commitdd02038adf738f719636db5098a281f6f3853e1e (patch)
treeb075304d87051c52de031dfed7f75e99814fe925
parentb0b57a5a2649d9d40f132633dd9a97aa8d771c8d (diff)
downloadkhimera-main.tar.gz
khimera-main.tar.xz
khimera-main.zip
fix: use APPIMAGE env var for base dir to avoid read-only mount pathHEADmain
-rw-r--r--khimera-main.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/khimera-main.go b/khimera-main.go
index 6cb0bdf..d53211d 100644
--- a/khimera-main.go
+++ b/khimera-main.go
@@ -75,14 +75,19 @@ func main() {
// detectPortableMode detects portable environment
func detectPortableMode() (*PortableConfig, error) {
- // Get executable location
- exe, err := os.Executable()
- if err != nil {
- return nil, fmt.Errorf("failed to get executable path: %w", err)
+ // When running as AppImage, APPIMAGE env var points to the actual .AppImage file
+ // os.Executable() would return the read-only mount path inside /tmp/.mount_*
+ var baseDir string
+ if appImagePath := os.Getenv("APPIMAGE"); appImagePath != "" {
+ baseDir = filepath.Dir(appImagePath)
+ } else {
+ exe, err := os.Executable()
+ if err != nil {
+ return nil, fmt.Errorf("failed to get executable path: %w", err)
+ }
+ baseDir = filepath.Dir(exe)
}
- baseDir := filepath.Dir(exe)
-
config := &PortableConfig{
IsPortable: true,
BaseDir: baseDir,