Loading pkgs/by-name/gu/gui-for-singbox/package.nix +6 −6 Original line number Diff line number Diff line { lib, stdenv, buildGoModule, buildGo126Module, fetchFromGitHub, autoPatchelfHook, copyDesktopItems, Loading @@ -18,13 +18,13 @@ let pname = "gui-for-singbox"; version = "1.19.0"; version = "1.21.0"; src = fetchFromGitHub { owner = "GUI-for-Cores"; repo = "GUI.for.SingBox"; tag = "v${version}"; hash = "sha256-CY5i5+ObqPVCPiqHLttjxhMOi9fiHp5HWX33fq43txw="; hash = "sha256-IGsH8QHoj2CvrSEc9eIisxySXQkjPSDBXsCPOXqANVM="; }; metaCommon = { Loading Loading @@ -54,7 +54,7 @@ let ; pnpm = pnpm_10; fetcherVersion = 2; hash = "sha256-AHGPAYw/6FRKO2FY1J84NrLcp+bZOclOF6UFY61npFI="; hash = "sha256-dWqwEnXPT+5N+36szm4AF1ChM9M6UJltct+EtQAofGQ="; }; buildPhase = '' Loading @@ -80,7 +80,7 @@ let }); in buildGoModule { buildGo126Module { inherit pname version src; patches = [ ./xdg-path-and-restart-patch.patch ]; Loading @@ -91,7 +91,7 @@ buildGoModule { --subst-var out ''; vendorHash = "sha256-xQ6TeVoBe8906+/5X1q4e5QHVo+KHymB+yoxM+Obk18="; vendorHash = "sha256-EeIxt0BzSaZh1F38btUXN9kAvj12nlqEerVgWVGkiuk="; nativeBuildInputs = [ autoPatchelfHook Loading pkgs/by-name/gu/gui-for-singbox/xdg-path-and-restart-patch.patch +2 −20 Original line number Diff line number Diff line --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -55,9 +55,14 @@ func CreateApp(fs embed.FS) *App { app := NewApp() - if Env.OS == "darwin" { - createMacOSSymlink() - createMacOSMenus(app) + if Env.OS == "linux" || Env.OS == "darwin" { + userConfigDir, err := os.UserConfigDir() + if err == nil { + targetPath := filepath.Join(userConfigDir, Env.AppName) + if err := os.MkdirAll(targetPath, 0755); err == nil { + Env.BasePath = targetPath + } + } } if Env.OS == "windows" { @@ -80,7 +85,10 @@ func (a *App) IsStartup() bool { } @@ -93,7 +93,10 @@ func (a *App) RestartApp() FlagResult { log.Printf("RestartApp") - exePath := Env.BasePath + "/" + Env.AppName + exePath, err := os.Executable() + if err != nil { Loading Loading
pkgs/by-name/gu/gui-for-singbox/package.nix +6 −6 Original line number Diff line number Diff line { lib, stdenv, buildGoModule, buildGo126Module, fetchFromGitHub, autoPatchelfHook, copyDesktopItems, Loading @@ -18,13 +18,13 @@ let pname = "gui-for-singbox"; version = "1.19.0"; version = "1.21.0"; src = fetchFromGitHub { owner = "GUI-for-Cores"; repo = "GUI.for.SingBox"; tag = "v${version}"; hash = "sha256-CY5i5+ObqPVCPiqHLttjxhMOi9fiHp5HWX33fq43txw="; hash = "sha256-IGsH8QHoj2CvrSEc9eIisxySXQkjPSDBXsCPOXqANVM="; }; metaCommon = { Loading Loading @@ -54,7 +54,7 @@ let ; pnpm = pnpm_10; fetcherVersion = 2; hash = "sha256-AHGPAYw/6FRKO2FY1J84NrLcp+bZOclOF6UFY61npFI="; hash = "sha256-dWqwEnXPT+5N+36szm4AF1ChM9M6UJltct+EtQAofGQ="; }; buildPhase = '' Loading @@ -80,7 +80,7 @@ let }); in buildGoModule { buildGo126Module { inherit pname version src; patches = [ ./xdg-path-and-restart-patch.patch ]; Loading @@ -91,7 +91,7 @@ buildGoModule { --subst-var out ''; vendorHash = "sha256-xQ6TeVoBe8906+/5X1q4e5QHVo+KHymB+yoxM+Obk18="; vendorHash = "sha256-EeIxt0BzSaZh1F38btUXN9kAvj12nlqEerVgWVGkiuk="; nativeBuildInputs = [ autoPatchelfHook Loading
pkgs/by-name/gu/gui-for-singbox/xdg-path-and-restart-patch.patch +2 −20 Original line number Diff line number Diff line --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -55,9 +55,14 @@ func CreateApp(fs embed.FS) *App { app := NewApp() - if Env.OS == "darwin" { - createMacOSSymlink() - createMacOSMenus(app) + if Env.OS == "linux" || Env.OS == "darwin" { + userConfigDir, err := os.UserConfigDir() + if err == nil { + targetPath := filepath.Join(userConfigDir, Env.AppName) + if err := os.MkdirAll(targetPath, 0755); err == nil { + Env.BasePath = targetPath + } + } } if Env.OS == "windows" { @@ -80,7 +85,10 @@ func (a *App) IsStartup() bool { } @@ -93,7 +93,10 @@ func (a *App) RestartApp() FlagResult { log.Printf("RestartApp") - exePath := Env.BasePath + "/" + Env.AppName + exePath, err := os.Executable() + if err != nil { Loading