1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Rename and document chooserPath

This commit is contained in:
Bartłomiej Dach 2022-06-16 21:51:31 +02:00
parent db02cb81c5
commit 6ff6a3f5b3
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -17,6 +17,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Database;
using osu.Game.Graphics.UserInterfaceV2;
using osuTK;
@ -36,7 +37,14 @@ namespace osu.Game.Screens.Edit.Setup
[Resolved]
private OsuGameBase game { get; set; } = null!;
private string? chooserPath;
/// <summary>
/// The initial path to use when displaying the <see cref="FileChooserPopover"/>.
/// </summary>
/// <remarks>
/// Uses a <see langword="null"/> value before the first selection is made
/// to ensure that the first selection starts at <see cref="GameHost.InitialFileSelectorPath"/>.
/// </remarks>
private string? initialChooserPath;
private readonly BindableWithCurrent<FileInfo?> current = new BindableWithCurrent<FileInfo?>();
@ -76,7 +84,7 @@ namespace osu.Game.Screens.Edit.Setup
if (file.NewValue != null)
this.HidePopover();
chooserPath = file.NewValue?.DirectoryName;
initialChooserPath = file.NewValue?.DirectoryName;
}
Task ICanAcceptFiles.Import(params string[] paths)
@ -104,7 +112,7 @@ namespace osu.Game.Screens.Edit.Setup
OnFocused = this.ShowPopover,
};
public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current, chooserPath);
public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current, initialChooserPath);
private class FileChooserPopover : OsuPopover
{