1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Fix first run locator stable locator directory desyncing between display & popover

This commit is contained in:
Bartłomiej Dach 2023-12-15 16:00:29 +01:00
parent b384c9f938
commit 91f4123aa7
No known key found for this signature in database

View File

@ -244,6 +244,8 @@ namespace osu.Game.Overlays.FirstRunSetup
[Resolved(canBeNull: true)] // Can't really be null but required to handle potential of disposal before DI completes.
private OsuGameBase? game { get; set; }
private bool changingDirectory;
protected override void LoadComplete()
{
base.LoadComplete();
@ -259,24 +261,37 @@ namespace osu.Game.Overlays.FirstRunSetup
private void onDirectorySelected(ValueChangedEvent<DirectoryInfo?> directory)
{
if (directory.NewValue == null)
{
Current.Value = string.Empty;
if (changingDirectory)
return;
try
{
changingDirectory = true;
if (directory.NewValue == null)
{
Current.Value = string.Empty;
return;
}
// DirectorySelectors can trigger a noop value changed, but `DirectoryInfo` equality doesn't catch this.
if (directory.OldValue?.FullName == directory.NewValue.FullName)
return;
if (legacyImportManager.IsUsableForStableImport(directory.NewValue, out var stableRoot))
{
this.HidePopover();
string path = stableRoot.FullName;
legacyImportManager.UpdateStorage(path);
Current.Value = path;
currentDirectory.Value = stableRoot;
}
}
// DirectorySelectors can trigger a noop value changed, but `DirectoryInfo` equality doesn't catch this.
if (directory.OldValue?.FullName == directory.NewValue.FullName)
return;
if (legacyImportManager.IsUsableForStableImport(directory.NewValue, out var stableRoot))
finally
{
this.HidePopover();
string path = stableRoot.FullName;
legacyImportManager.UpdateStorage(path);
Current.Value = path;
changingDirectory = false;
}
}