mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 05:52:54 +08:00
Allow new common cases when a user is locating a stable osu! install directory for import
This commit is contained in:
parent
48e89b903c
commit
6e7e243e70
@ -15,7 +15,16 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|||||||
|
|
||||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||||
|
|
||||||
protected override bool IsValidDirectory(DirectoryInfo? info) => info?.GetFiles("osu!.*.cfg").Any() ?? false;
|
protected override bool IsValidDirectory(DirectoryInfo? info) =>
|
||||||
|
// A full stable installation will have a configuration file present.
|
||||||
|
// This is the best case scenario, as it may contain a custom beatmap directory we need to traverse to.
|
||||||
|
info?.GetFiles("osu!.*.cfg").Any() == true ||
|
||||||
|
// The user may only have their songs or skins folders left.
|
||||||
|
// We still want to allow them to import based on this.
|
||||||
|
info?.GetDirectories("Songs").Any() == true ||
|
||||||
|
info?.GetDirectories("Skins").Any() == true ||
|
||||||
|
// The user may have traverse *inside* their songs or skins folders.
|
||||||
|
shouldUseParentDirectory(info);
|
||||||
|
|
||||||
public override LocalisableString HeaderText => "Please select your osu!stable install location";
|
public override LocalisableString HeaderText => "Please select your osu!stable install location";
|
||||||
|
|
||||||
@ -26,7 +35,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|||||||
|
|
||||||
protected override void OnSelection(DirectoryInfo directory)
|
protected override void OnSelection(DirectoryInfo directory)
|
||||||
{
|
{
|
||||||
taskCompletionSource.TrySetResult(directory.FullName);
|
taskCompletionSource.TrySetResult(shouldUseParentDirectory(directory) ? directory.Parent!.FullName : directory.FullName);
|
||||||
this.Exit();
|
this.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,5 +44,8 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
|
|||||||
taskCompletionSource.TrySetCanceled();
|
taskCompletionSource.TrySetCanceled();
|
||||||
return base.OnExiting(e);
|
return base.OnExiting(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool shouldUseParentDirectory(DirectoryInfo? info)
|
||||||
|
=> info?.Parent != null && (info?.Name == "Songs" || info?.Name == "Skins");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user