gui-for-clash: 1.11.0 -> 1.16.0
This commit is contained in:
@@ -16,13 +16,13 @@
|
||||
|
||||
let
|
||||
pname = "gui-for-clash";
|
||||
version = "1.11.0";
|
||||
version = "1.16.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "GUI-for-Cores";
|
||||
repo = "GUI.for.Clash";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-kk6ZjG58gMIPd8f3Ib+1z7bie9X5kJvBq/CwioksbcU=";
|
||||
hash = "sha256-eIKgXZ48iVkFSwTJ04j6CXyvgVsUCBRZ9hwdid/DwsE=";
|
||||
};
|
||||
|
||||
metaCommon = {
|
||||
@@ -50,7 +50,7 @@ let
|
||||
sourceRoot
|
||||
;
|
||||
fetcherVersion = 2;
|
||||
hash = "sha256-MvGLIB68itkCGsBIgAI6ak5xa5rFAJfoAwNuISPRw30=";
|
||||
hash = "sha256-oi78tk0ygR37jtWW3hZnDF44qxWjIFvUU4u5rNffvD8=";
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
@@ -80,13 +80,7 @@ buildGoModule {
|
||||
|
||||
patches = [ ./xdg-path-and-restart-patch.patch ];
|
||||
|
||||
# As we need the $out reference, we can't use `replaceVars` here.
|
||||
postPatch = ''
|
||||
substituteInPlace bridge/bridge.go \
|
||||
--subst-var out
|
||||
'';
|
||||
|
||||
vendorHash = "sha256-6T9cFVzfRJnwnWjc61oSihifgnP81n3K+jlLHXGmA4I=";
|
||||
vendorHash = "sha256-ElDJknPzR7Zh46RjUsn39Msm1B8Nsp1eHIS3ifRl80w=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
--- 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.Clash"
|
||||
+ xdgDataHome := os.Getenv("XDG_DATA_HOME")
|
||||
+ if xdgDataHome == "" {
|
||||
+ homeDir, _ := os.UserHomeDir()
|
||||
+ xdgDataHome = filepath.Join(homeDir, ".local", "share")
|
||||
@@ -55,9 +55,14 @@
|
||||
|
||||
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
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
-
|
||||
- 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 @@
|
||||
|
||||
if Env.OS == "windows" {
|
||||
@@ -80,7 +85,10 @@
|
||||
}
|
||||
|
||||
|
||||
func (a *App) RestartApp() FlagResult {
|
||||
- exePath := Env.BasePath + "/" + Env.AppName
|
||||
+ exePath := "@out@/bin" + "/" + Env.AppName
|
||||
|
||||
+ exePath, err := os.Executable()
|
||||
+ if err != nil {
|
||||
+ exePath = filepath.Join(Env.BasePath, Env.AppName)
|
||||
+ }
|
||||
|
||||
cmd := exec.Command(exePath)
|
||||
SetCmdWindowHidden(cmd)
|
||||
|
||||
Reference in New Issue
Block a user