mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 10:42:54 +08:00
Fix file chooser path not opening home directory initially
This commit is contained in:
parent
47d0ecf5e8
commit
db02cb81c5
@ -36,6 +36,8 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuGameBase game { get; set; } = null!;
|
private OsuGameBase game { get; set; } = null!;
|
||||||
|
|
||||||
|
private string? chooserPath;
|
||||||
|
|
||||||
private readonly BindableWithCurrent<FileInfo?> current = new BindableWithCurrent<FileInfo?>();
|
private readonly BindableWithCurrent<FileInfo?> current = new BindableWithCurrent<FileInfo?>();
|
||||||
|
|
||||||
public Bindable<FileInfo?> Current
|
public Bindable<FileInfo?> Current
|
||||||
@ -73,6 +75,8 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
{
|
{
|
||||||
if (file.NewValue != null)
|
if (file.NewValue != null)
|
||||||
this.HidePopover();
|
this.HidePopover();
|
||||||
|
|
||||||
|
chooserPath = file.NewValue?.DirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Task ICanAcceptFiles.Import(params string[] paths)
|
Task ICanAcceptFiles.Import(params string[] paths)
|
||||||
@ -100,16 +104,16 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
OnFocused = this.ShowPopover,
|
OnFocused = this.ShowPopover,
|
||||||
};
|
};
|
||||||
|
|
||||||
public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current);
|
public Popover GetPopover() => new FileChooserPopover(handledExtensions, Current, chooserPath);
|
||||||
|
|
||||||
private class FileChooserPopover : OsuPopover
|
private class FileChooserPopover : OsuPopover
|
||||||
{
|
{
|
||||||
public FileChooserPopover(string[] handledExtensions, Bindable<FileInfo?> currentFile)
|
public FileChooserPopover(string[] handledExtensions, Bindable<FileInfo?> currentFile, string? chooserPath)
|
||||||
{
|
{
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
Size = new Vector2(600, 400),
|
Size = new Vector2(600, 400),
|
||||||
Child = new OsuFileSelector(currentFile.Value?.DirectoryName, handledExtensions)
|
Child = new OsuFileSelector(chooserPath, handledExtensions)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
CurrentFile = { BindTarget = currentFile }
|
CurrentFile = { BindTarget = currentFile }
|
||||||
|
Loading…
Reference in New Issue
Block a user