nixpkgs/pkgs/by-name/gu/gui-for-singbox/bridge.patch
2024-11-03 02:28:47 +08:00

35 lines
827 B
Diff

--- old/bridge/bridge.go 2024-11-03 02:07:33.553972040 +0800
+++ new/bridge/bridge.go 2024-11-03 02:10:09.239584378 +0800
@@ -38,11 +38,6 @@
func InitBridge(fs embed.FS) {
// step1: Set Env
- exePath, err := os.Executable()
- if err != nil {
- panic(err)
- }
-
for _, v := range os.Args {
if v == "tasksch" {
Env.FromTaskSch = true
@@ -50,8 +45,8 @@
}
}
- Env.BasePath = filepath.Dir(exePath)
- Env.AppName = filepath.Base(exePath)
+ Env.AppName = "GUI.for.SingBox"
+ Env.BasePath = filepath.Join(os.Getenv("HOME"), ".config", Env.AppName)
// step2: Create a persistent data symlink
if Env.OS == "darwin" {
@@ -128,7 +123,7 @@
}
func (a *App) RestartApp() FlagResult {
- exePath := Env.BasePath + "/" + Env.AppName
+ exePath := Env.AppName
cmd := exec.Command(exePath)
HideExecWindow(cmd)