diff --git a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs index 6c56320666..ab83c2a2e4 100644 --- a/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs +++ b/osu.Game/Screens/Edit/Setup/LabelledFileChooser.cs @@ -36,6 +36,8 @@ namespace osu.Game.Screens.Edit.Setup [Resolved] private OsuGameBase game { get; set; } = null!; + private string? chooserPath; + private readonly BindableWithCurrent current = new BindableWithCurrent(); public Bindable Current @@ -73,6 +75,8 @@ namespace osu.Game.Screens.Edit.Setup { if (file.NewValue != null) this.HidePopover(); + + chooserPath = file.NewValue?.DirectoryName; } Task ICanAcceptFiles.Import(params string[] paths) @@ -100,16 +104,16 @@ namespace osu.Game.Screens.Edit.Setup OnFocused = this.ShowPopover, }; - public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current); + public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current, chooserPath); private class FileChooserPopover : OsuPopover { - public FileChooserPopover(string[] handledExtensions, Bindable currentFile) + public FileChooserPopover(string[] handledExtensions, Bindable currentFile, string? chooserPath) { Child = new Container { Size = new Vector2(600, 400), - Child = new OsuFileSelector(currentFile.Value?.DirectoryName, handledExtensions) + Child = new OsuFileSelector(chooserPath, handledExtensions) { RelativeSizeAxes = Axes.Both, CurrentFile = { BindTarget = currentFile }