Skip to content

Commit

Permalink
修复导致插件调用SetHome报错
Browse files Browse the repository at this point in the history
  • Loading branch information
indiff committed Mar 31, 2024
1 parent 3e624d1 commit 90d11b9
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion SetHome/SetHomeForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ private void SetHomeForm_Load(object sender, EventArgs e)
}

if (isRun) {
Dispose();
// Dispose(); // 这里导致插件执行报错
Application.Exit();
}

Expand Down Expand Up @@ -434,6 +434,55 @@ private string filterEmpty(string ignoreFileName)

private static string joinDevPath(string oldPath)
{
/*
// 处理一些 oldPath 为空的情况
HashSet<string> hs = new HashSet<string>();
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;"
Expand Down

0 comments on commit 90d11b9

Please sign in to comment.