1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Disallow selecting storage root as a valid directory.

This commit is contained in:
Lucas A 2021-05-13 11:14:05 +02:00
parent d3cc418961
commit eee3cd7c57

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
/// <param name="directory">The selected directory</param>
protected abstract void OnSelection(DirectoryInfo directory);
protected virtual bool IsValidDirectory(DirectoryInfo info) => info != null;
protected virtual bool IsValidDirectory(DirectoryInfo info) => true;
protected virtual DirectoryInfo InitialPath => null;
@ -106,7 +106,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
if (InitialPath != null)
directorySelector.CurrentPath.Value = InitialPath;
directorySelector.CurrentPath.BindValueChanged(e => selectionButton.Enabled.Value = IsValidDirectory(e.NewValue), true);
directorySelector.CurrentPath.BindValueChanged(e => selectionButton.Enabled.Value = e.NewValue != null ? IsValidDirectory(e.NewValue) : false, true);
base.LoadComplete();
}