From 46b864e638036f61a7dac29abd2b1cf6763fc5f4 Mon Sep 17 00:00:00 2001 From: aaron <462826@qq.com> Date: Thu, 20 Aug 2020 11:14:54 +0800 Subject: [PATCH] close task#7667 --- res/zh/messages.json | 2 +- src/utils/config/config.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/res/zh/messages.json b/res/zh/messages.json index 5f55f5b2..98a7f1f5 100644 --- a/res/zh/messages.json +++ b/res/zh/messages.json @@ -23,7 +23,7 @@ }, { "id": "add_to_path_tips_win", - "translation": "您可运行%s将zd.exe加入$PATH环境变量,以方便在任何目录中执行。" + "translation": "您可运行 %s 将zd.exe加入$PATH环境变量,以方便在任何目录中执行。" }, { "id": "add_to_path_win", diff --git a/src/utils/config/config.go b/src/utils/config/config.go index 9165eea0..ffdcf602 100644 --- a/src/utils/config/config.go +++ b/src/utils/config/config.go @@ -146,7 +146,8 @@ func InputForSet() { // set PATH environment vari var addToPath bool if commonUtils.IsWin() { - stdinUtils.InputForBool(&addToPath, true, "add_to_path_win") + addToPath = true + // stdinUtils.InputForBool(&addToPath, true, "add_to_path_win") } else { stdinUtils.InputForBool(&addToPath, true, "add_to_path_linux") } @@ -174,8 +175,8 @@ func addZdToPathWin(home string) { pathVar := os.Getenv("PATH") if strings.Contains(pathVar, vari.ExeDir) { return } - cmd := fmt.Sprintf(`setx Path "%%Path%%;%s"`, vari.ExeDir) - logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("add_to_path_tips_win", cmd), color.FgRed) + cmd := `setx Path "%%Path%%;` + vari.ExeDir + `"` + logUtils.PrintToWithColor("\n" + i118Utils.I118Prt.Sprintf("add_to_path_tips_win", cmd), color.FgRed) // TODO: fix the space issue //out, err := shellUtils.ExeShell(cmd) -- GitLab