Files
nixpkgs/pkgs/by-name/gu/gui-for-singbox/xdg-path-and-restart-patch.patch
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

32 lines
796 B
Diff

--- a/bridge/bridge.go
+++ b/bridge/bridge.go
@@ -41,13 +41,13 @@
}
func CreateApp(fs embed.FS) *App {
- exePath, err := os.Executable()
- if err != nil {
- panic(err)
+ Env.AppName = "GUI.for.SingBox"
+ xdgDataHome := os.Getenv("XDG_DATA_HOME")
+ if xdgDataHome == "" {
+ homeDir, _ := os.UserHomeDir()
+ xdgDataHome = filepath.Join(homeDir, ".local", "share")
}
-
- Env.BasePath = filepath.Dir(exePath)
- Env.AppName = filepath.Base(exePath)
+ Env.BasePath = filepath.Join(xdgDataHome, Env.AppName)
if slices.Contains(os.Args, "tasksch") {
Env.FromTaskSch = true
@@ -76,7 +76,7 @@
}
func (a *App) RestartApp() FlagResult {
- exePath := Env.BasePath + "/" + Env.AppName
+ exePath := "@basepath@/bin" + "/" + Env.AppName
cmd := exec.Command(exePath)
SetCmdWindowHidden(cmd)