From a295cf62504441a2b50adc5aed9ced138d5b26fa Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Sat, 27 Mar 2021 03:00:54 +0800 Subject: [PATCH] Update Append bin to PATH --- Netch/Netch.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Netch/Netch.cs b/Netch/Netch.cs index 7fa88b78..81a3b337 100644 --- a/Netch/Netch.cs +++ b/Netch/Netch.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using Netch.Controllers; using Netch.Forms; using Netch.Utils; +using static Vanara.PInvoke.Kernel32; namespace Netch { @@ -33,9 +34,9 @@ namespace Netch // 设置当前目录 Directory.SetCurrentDirectory(Global.NetchDir); - Environment.SetEnvironmentVariable("PATH", - Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process) + ";" + Path.Combine(Global.NetchDir, "bin"), - EnvironmentVariableTarget.Process); + var binPath = Path.Combine(Global.NetchDir, "bin"); + Environment.SetEnvironmentVariable("PATH", $"{Environment.GetEnvironmentVariable("PATH")};{binPath}"); + AddDllDirectory(binPath); Updater.Updater.CleanOld(Global.NetchDir);