From fc4e29793d86b969f6b3e57e68ff550f3856cc31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 16 Feb 2026 16:46:30 +0100 Subject: [PATCH] Use directory of last-selected sample as initial directory in sample set add controls (#36680) Closes https://github.com/ppy/osu/issues/36470. Applied directly to relevant control for now. --- osu.Game/Screens/Edit/Components/FormSampleSet.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Components/FormSampleSet.cs b/osu.Game/Screens/Edit/Components/FormSampleSet.cs index 2d3404a513..370d36dd8c 100644 --- a/osu.Game/Screens/Edit/Components/FormSampleSet.cs +++ b/osu.Game/Screens/Edit/Components/FormSampleSet.cs @@ -46,6 +46,7 @@ namespace osu.Game.Screens.Edit.Components private readonly BindableWithCurrent current = new BindableWithCurrent(); private readonly Dictionary<(string name, string bank), SampleButton> buttons = new Dictionary<(string, string), SampleButton>(); + private readonly Bindable lastSelectedFileDirectory = new Bindable(); private FormControlBackground background = null!; private FormFieldCaption caption = null!; @@ -125,6 +126,7 @@ namespace osu.Game.Screens.Edit.Components Margin = new MarginPadding(5), SampleAddRequested = SampleAddRequested, SampleRemoveRequested = SampleRemoveRequested, + LastSelectedFileDirectory = { BindTarget = lastSelectedFileDirectory }, }; protected override void LoadComplete() @@ -197,6 +199,7 @@ namespace osu.Game.Screens.Edit.Components public Action? SampleRemoveRequested { get; init; } private Bindable selectedFile { get; } = new Bindable(); + public Bindable LastSelectedFileDirectory { get; } = new Bindable(); private TrianglesV2? triangles { get; set; } @@ -313,6 +316,7 @@ namespace osu.Game.Screens.Edit.Components this.HidePopover(); ActualFilename.Value = SampleAddRequested?.Invoke(selectedFile.Value, ExpectedFilename.Value) ?? selectedFile.Value.ToString(); + LastSelectedFileDirectory.Value = selectedFile.Value.Directory; } private void deleteSample() @@ -324,7 +328,9 @@ namespace osu.Game.Screens.Edit.Components ActualFilename.Value = null; } - public Popover? GetPopover() => ActualFilename.Value == null ? new FormFileSelector.FileChooserPopover(SupportedExtensions.AUDIO_EXTENSIONS, selectedFile, null) : null; + public Popover? GetPopover() => ActualFilename.Value == null + ? new FormFileSelector.FileChooserPopover(SupportedExtensions.AUDIO_EXTENSIONS, selectedFile, LastSelectedFileDirectory.Value?.FullName) + : null; public MenuItem[]? ContextMenuItems => ActualFilename.Value != null