Skip to content

Commit 0f1929a

Browse files
committed
Fix: suggest upgrade version for project with missing Unity installation (#192)
1 parent 3f05e25 commit 0f1929a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

UnityLauncherPro/Tools.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,14 @@ static bool CheckCrashBackupScene(string projectPath)
413413
{
414414
Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
415415
var uniqueFileName = "Recovered_Scene" + unixTimestamp + ".unity";
416-
416+
417417
try
418418
{
419419
File.Move(recoveryFile, Path.Combine(restoreFolder, uniqueFileName));
420420
// remove folder, otherwise unity 6000.2 asks for recovery
421421
Directory.Delete(Path.Combine(projectPath, "Temp", "__Backupscenes"), true);
422422

423-
Console.WriteLine("moved file to "+ uniqueFileName);
423+
Console.WriteLine("moved file to " + uniqueFileName);
424424
}
425425
catch (IOException)
426426
{
@@ -1130,8 +1130,7 @@ public static string FindNearestVersion(string currentVersion, List<string> allA
11301130
string result = null;
11311131

11321132
// add current version to list, to sort it with others
1133-
if (!allAvailable.Contains(currentVersion))
1134-
allAvailable.Add(currentVersion);
1133+
if (!allAvailable.Contains(currentVersion)) allAvailable.Add(currentVersion);
11351134

11361135
// sort list
11371136
if (checkBelow)
@@ -1181,6 +1180,7 @@ public static long VersionAsLong(string version)
11811180
multiplier *= 50;
11821181
}
11831182
}
1183+
11841184
return result;
11851185
}
11861186

UnityLauncherPro/UpgradeWindow.xaml.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ public UpgradeWindow(string currentVersion, string projectPath, string commandLi
3737
txtCurrentVersion.BorderBrush = Brushes.Red;
3838
txtCurrentVersion.BorderThickness = new Thickness(1);
3939
}
40-
else // not null
40+
41+
if (currentVersion != null)
4142
{
4243
// remove china c1 from version
43-
if (currentVersion.Contains('c')) currentVersion = currentVersion.Replace("c1", "");
44+
if (currentVersion.Contains("c")) currentVersion = currentVersion.Replace("c1", "");
4445
// find nearest version
4546
string nearestVersion = Tools.FindNearestVersion(currentVersion, MainWindow.unityInstalledVersions.Keys.ToList());
4647

0 commit comments

Comments
 (0)