Skip to content

Commit 4a1226e

Browse files
committed
try to handle version splitting better for uninstaller, fix #140
1 parent ec8b7ca commit 4a1226e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: UnityLauncherPro/Tools.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1981,13 +1981,17 @@ internal static void UninstallEditor(string path, string version)
19811981
Console.WriteLine("Cleanup firewall: " + cmd);
19821982
LaunchExe("cmd.exe", "/c " + cmd);
19831983

1984-
if (int.Parse(version.Substring(0, 4)) <= 2017)
1984+
int year;
1985+
string[] parts = version.Split('.');
1986+
// TODO handle unity 6.x
1987+
if (parts.Length >= 1 && int.TryParse(parts[0], out year) && year <= 2017)
19851988
{
19861989
var nodeFolder = Path.Combine(installFolder, "Editor", "Data", "Tools", "nodejs", "node.exe");
19871990
cmd = "netsh advfirewall firewall delete rule name=all program=\"" + nodeFolder + "\"";
19881991
Console.WriteLine("Cleanup firewall <= 2017: " + cmd);
19891992
LaunchExe("cmd.exe", "/c " + cmd);
19901993
}
1994+
19911995
// remove registry entries
19921996
var unityKeyName = "HKEY_CURRENT_USER\\Software\\Unity Technologies\\Installer\\Unity " + version;
19931997
cmd = "reg delete " + unityKeyName + " /f";

0 commit comments

Comments
 (0)