Unverified Commit 8cdde30d authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

gui-for-clash: 1.9.5 -> 1.9.7 (#406616)

parents a0bcecc8 ddff0289
Loading
Loading
Loading
Loading
+15 −23
Original line number Diff line number Diff line
--- a/bridge/bridge.go	2024-12-25 20:53:45.504021585 +0000
+++ b/bridge/bridge.go	2024-12-25 21:02:20.318422528 +0000
@@ -38,11 +38,6 @@
@@ -41,13 +41,13 @@
 }

 func InitBridge(fs embed.FS) {
 	// step1: Set Env
 func CreateApp(fs embed.FS) *App {
-	exePath, err := os.Executable()
-	if err != nil {
-		panic(err)
-	}
-
 	for _, v := range os.Args {
 		if v == "tasksch" {
 			Env.FromTaskSch = true
@@ -50,8 +45,13 @@
 		}
 	}
 
-	Env.BasePath = filepath.Dir(exePath)
-	Env.AppName = filepath.Base(exePath)
+	Env.AppName = "GUI.for.Clash"
+	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)

 	// step2: Create a persistent data symlink
 	if Env.OS == "darwin" {
@@ -128,7 +128,7 @@
 	if slices.Contains(os.Args, "tasksch") {
 		Env.FromTaskSch = true
@@ -76,7 +76,7 @@
 }

 func (a *App) RestartApp() FlagResult {
@@ -36,4 +28,4 @@
+	exePath := "@basepath@/bin" + "/" + Env.AppName

 	cmd := exec.Command(exePath)
 	HideExecWindow(cmd)
 	SetCmdWindowHidden(cmd)
 No newline at end of file
+7 −11
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  nodejs,
  pnpm_9,
  fetchFromGitHub,
  buildGoModule,
  lib,
  wails,
  webkitgtk_4_0,
  pkg-config,
@@ -17,13 +17,13 @@

let
  pname = "gui-for-clash";
  version = "1.9.5";
  version = "1.9.7";

  src = fetchFromGitHub {
    owner = "GUI-for-Cores";
    repo = "GUI.for.Clash";
    tag = "v${version}";
    hash = "sha256-XQbiric4iAxvWRLKCCZtDrpFpPCylQlwnCm9dHSq/KM=";
    hash = "sha256-Ij9zyBzYpAfDEjJXqOiPxun+5e1T5j3juYudpvraBcQ=";
  };

  metaCommon = {
@@ -43,7 +43,7 @@ let
    pnpmDeps = pnpm_9.fetchDeps {
      inherit (finalAttrs) pname version src;
      sourceRoot = "${finalAttrs.src.name}/frontend";
      hash = "sha256-5SVu8eCyN89k6BvNEqgs4hOrP5IjvjUZrzrVuDwtYCk=";
      hash = "sha256-5tz1FItH9AvZhJjka8i5Kz22yf/tEmRPkDhz6iswZzc=";
    };

    sourceRoot = "${finalAttrs.src.name}/frontend";
@@ -81,7 +81,7 @@ buildGoModule {
      --replace-fail '@basepath@' "$out"
  '';

  vendorHash = "sha256-Zt3We+Ai8oEqof2eQvcaIkocH85goeldmPf4mmDX17o=";
  vendorHash = "sha256-Coq8GtaIS7ClmOTFw6PSgGDFW/CpGpKPvXgNw8qz3Hs=";

  nativeBuildInputs = [
    wails
@@ -114,12 +114,8 @@ buildGoModule {
      icon = "gui-for-clash";
      genericName = "GUI.for.Clash";
      desktopName = "GUI.for.Clash";
      categories = [
        "Network"
      ];
      keywords = [
        "Proxy"
      ];
      categories = [ "Network" ];
      keywords = [ "Proxy" ];
    })
  ];