From 90d11b98f2e744651c90f6c2b326248692355cb8 Mon Sep 17 00:00:00 2001 From: indiff Date: Sun, 31 Mar 2024 16:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E8=87=B4=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E8=B0=83=E7=94=A8SetHome=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SetHome/SetHomeForm.cs | 51 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/SetHome/SetHomeForm.cs b/SetHome/SetHomeForm.cs index c60d607..0324f92 100644 --- a/SetHome/SetHomeForm.cs +++ b/SetHome/SetHomeForm.cs @@ -397,7 +397,7 @@ private void SetHomeForm_Load(object sender, EventArgs e) } if (isRun) { - Dispose(); + // Dispose(); // 这里导致插件执行报错 Application.Exit(); } @@ -434,6 +434,55 @@ private string filterEmpty(string ignoreFileName) private static string joinDevPath(string oldPath) { + /* + // 处理一些 oldPath 为空的情况 + HashSet hs = new HashSet(); + oldPath = oldPath.Trim(); + string[] sArray = oldPath.Split(';'); + if (sArray.Length > 0) + { + bool existSystem32 = false; + string str = @"C:\Windows\System32"; + foreach (string stmp in sArray) + { + if (!existSystem32) { + // Dir exist + bool flag = str.Equals(stmp, StringComparison.OrdinalIgnoreCase); + if (flag) + { + existSystem32 = true; + } + } + + if (!string.IsNullOrEmpty(stmp.Trim()) && Directory.Exists(stmp)) + { + hs.Add(stmp); + } + } + + if (!existSystem32) + { + hs.Add(str); + } + // C:\Windows\System32 + string[] strs = hs.ToArray(); + oldPath = String.Join(";", strs); + if (!oldPath.EndsWith(";")) { + oldPath += ";"; + } + } + + if (String.IsNullOrEmpty(oldPath.Trim())) + { + oldPath = @"C:\Windows\System32;"; + } + + if (oldPath.Trim().Equals(";") || IsSemicolon(oldPath)) + { + oldPath = @"C:\Windows\System32;"; + } + */ + return oldPath + @"%JAVA_HOME%\bin;" + @"%M2_HOME%\bin;"