Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ee7cb29

Browse files
move crash recovery scene fixes #186
1 parent e6a8728 commit ee7cb29

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

‎UnityLauncherPro/Tools.cs‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static bool CheckCrashBackupScene(string projectPath)
400400
var recoveryFile = Path.Combine(projectPath, "Temp", "__Backupscenes", "0.backup");
401401
if (File.Exists(recoveryFile))
402402
{
403-
var result = MessageBox.Show("Crash recovery scene found, do you want to copy it into Assets/_Recovery/-folder?", "UnityLauncherPro - Scene Recovery", MessageBoxButton.YesNo, MessageBoxImage.Question);
403+
var result = MessageBox.Show("Crash recovery scene found, do you want to MOVE it into Assets/_Recovery/-folder?", "UnityLauncherPro - Scene Recovery", MessageBoxButton.YesNo, MessageBoxImage.Question);
404404
if (result == MessageBoxResult.Yes)
405405
{
406406
var restoreFolder = Path.Combine(projectPath, "Assets", "_Recovery");
@@ -412,7 +412,22 @@ static bool CheckCrashBackupScene(string projectPath)
412412
{
413413
Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
414414
var uniqueFileName = "Recovered_Scene" + unixTimestamp + ".unity";
415-
File.Copy(recoveryFile, Path.Combine(restoreFolder, uniqueFileName));
415+
416+
try
417+
{
418+
File.Move(recoveryFile, Path.Combine(restoreFolder, uniqueFileName));
419+
// remove folder, otherwise unity 6000.2 asks for recovery
420+
Directory.Delete(Path.Combine(projectPath, "Temp", "__Backupscenes"), true);
421+
422+
Console.WriteLine("moved file to "+ uniqueFileName);
423+
}
424+
catch (IOException)
425+
{
426+
// if move failed, try copy
427+
File.Copy(recoveryFile, Path.Combine(restoreFolder, uniqueFileName));
428+
Console.WriteLine("copied file");
429+
}
430+
416431
Console.WriteLine("Recovered crashed scene into: " + restoreFolder);
417432
}
418433
else
@@ -2746,7 +2761,7 @@ internal static bool RunExclusionElevated(IEnumerable<string> paths, bool silent
27462761
{
27472762
MessageBox.Show("Operation cancelled or failed due to insufficient privileges.", "Cancelled", MessageBoxButton.OK, MessageBoxImage.Warning);
27482763
}
2749-
return false;
2764+
return false;
27502765
}
27512766

27522767
return true;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /