mirror of
https://github.com/ppy/osu
synced 2025-01-29 17:23:03 +00:00
Merge pull request #29562 from peppy/remove-migration-leftover-message
Remove "leftover files" notification when migration partly fails
This commit is contained in:
commit
b3e961f6c5
@ -34,11 +34,6 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString ProhibitedInteractDuringMigration => new TranslatableString(getKey(@"prohibited_interact_during_migration"), @"Please avoid interacting with the game!");
|
||||
|
||||
/// <summary>
|
||||
/// "Some files couldn't be cleaned up during migration. Clicking this notification will open the folder so you can manually clean things up."
|
||||
/// </summary>
|
||||
public static LocalisableString FailedCleanupNotification => new TranslatableString(getKey(@"failed_cleanup_notification"), @"Some files couldn't be cleaned up during migration. Clicking this notification will open the folder so you can manually clean things up.");
|
||||
|
||||
/// <summary>
|
||||
/// "Please select a new location"
|
||||
/// </summary>
|
||||
|
@ -515,6 +515,12 @@ namespace osu.Game
|
||||
/// <returns>Whether a restart operation was queued.</returns>
|
||||
public virtual bool RestartAppWhenExited() => false;
|
||||
|
||||
/// <summary>
|
||||
/// Perform migration of user data to a specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path to migrate to.</param>
|
||||
/// <returns>Whether migration succeeded to completion. If <c>false</c>, some files were left behind.</returns>
|
||||
/// <exception cref="TimeoutException"></exception>
|
||||
public bool Migrate(string path)
|
||||
{
|
||||
Logger.Log($@"Migrating osu! data from ""{Storage.GetFullPath(string.Empty)}"" to ""{path}""...");
|
||||
@ -542,10 +548,10 @@ namespace osu.Game
|
||||
if (!readyToRun.Wait(30000) || !success)
|
||||
throw new TimeoutException("Attempting to block for migration took too long.");
|
||||
|
||||
bool? cleanupSucceded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));
|
||||
bool? cleanupSucceeded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));
|
||||
|
||||
Logger.Log(@"Migration complete!");
|
||||
return cleanupSucceded != false;
|
||||
return cleanupSucceeded != false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -6,17 +6,14 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Screens;
|
||||
using osuTK;
|
||||
|
||||
@ -29,15 +26,6 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
[Resolved(canBeNull: true)]
|
||||
private OsuGame game { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private INotificationOverlay notifications { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Storage storage { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
|
||||
public override bool AllowBackButton => false;
|
||||
|
||||
public override bool AllowExternalScreenChange => false;
|
||||
@ -99,8 +87,6 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
|
||||
Beatmap.Value = Beatmap.Default;
|
||||
|
||||
var originalStorage = new NativeStorage(storage.GetFullPath(string.Empty), host);
|
||||
|
||||
migrationTask = Task.Run(PerformMigration)
|
||||
.ContinueWith(task =>
|
||||
{
|
||||
@ -108,18 +94,6 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
||||
{
|
||||
Logger.Error(task.Exception, $"Error during migration: {task.Exception?.Message}");
|
||||
}
|
||||
else if (!task.GetResultSafely())
|
||||
{
|
||||
notifications.Post(new SimpleNotification
|
||||
{
|
||||
Text = MaintenanceSettingsStrings.FailedCleanupNotification,
|
||||
Activated = () =>
|
||||
{
|
||||
originalStorage.PresentExternally();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Schedule(this.Exit);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user