summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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,