From 7b19e041cbbc4a2f72739b7cd144b63bbcb7b905 Mon Sep 17 00:00:00 2001 From: KeatonTheBot Date: Mon, 15 Jun 2026 01:44:24 +0000 Subject: [PATCH] Linux: Fix remaining file/folder picker issues (#24) I fixed the remaining Linux file picker issues after testing on Steam Deck. User profile images, mod manager, title manager, and DLC directory were still using the old file picker methods and not the helper methods. I could only apply the helper method to user profiles, but I came up with a workaround for the others. The reason for the draft PR: I'd ideally like to fix the other three at the helper level, so maybe @greem can help with that since since he wrote the initial implementation. Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/24 --- .../UI/ViewModels/DownloadableContentManagerViewModel.cs | 5 +++-- src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs | 5 +++-- src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs | 5 +++-- .../UI/Views/User/UserProfileImageSelectorView.axaml.cs | 8 +++++--- src/Ryujinx/Utilities/StorageProviderExtensions.cs | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs index c74580dfd..9507170d3 100644 --- a/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/DownloadableContentManagerViewModel.cs @@ -13,6 +13,7 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Threading.Tasks; +using static Ryujinx.Ava.Utilities.StorageProviderExtensions; namespace Ryujinx.Ava.UI.ViewModels { @@ -128,7 +129,7 @@ namespace Ryujinx.Ava.UI.ViewModels public async void Add() { - IReadOnlyList result = await _storageProvider.OpenFilePickerAsync(new FilePickerOpenOptions + IReadOnlyList result = await CoreDumpable(() => _storageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { Title = LocaleManager.Instance[LocaleKeys.SelectDlcDialogTitle], AllowMultiple = true, @@ -141,7 +142,7 @@ namespace Ryujinx.Ava.UI.ViewModels MimeTypes = ["application/x-nx-nsp"], }, }, - }); + })); int totalDlcAdded = 0; foreach (IStorageFile file in result) diff --git a/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs b/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs index 45e67add0..14b0f1fa5 100644 --- a/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/ModManagerViewModel.cs @@ -17,6 +17,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; +using static Ryujinx.Ava.Utilities.StorageProviderExtensions; namespace Ryujinx.Ava.UI.ViewModels { @@ -288,11 +289,11 @@ namespace Ryujinx.Ava.UI.ViewModels public async void Add() { - IReadOnlyList result = await _storageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions + IReadOnlyList result = await CoreDumpable(() => _storageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions { Title = LocaleManager.Instance[LocaleKeys.SelectModDialogTitle], AllowMultiple = true, - }); + })); foreach (IStorageFolder folder in result) { diff --git a/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs b/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs index 8393bc93c..c73553f80 100644 --- a/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/TitleUpdateViewModel.cs @@ -11,6 +11,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; +using static Ryujinx.Ava.Utilities.StorageProviderExtensions; namespace Ryujinx.Ava.UI.ViewModels { @@ -148,7 +149,7 @@ namespace Ryujinx.Ava.UI.ViewModels public async Task Add() { - IReadOnlyList result = await _storageProvider.OpenFilePickerAsync(new FilePickerOpenOptions + IReadOnlyList result = await CoreDumpable(() => _storageProvider.OpenFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = true, FileTypeFilter = new List @@ -160,7 +161,7 @@ namespace Ryujinx.Ava.UI.ViewModels MimeTypes = ["application/x-nx-nsp"], }, }, - }); + })); int totalUpdatesAdded = 0; foreach (IStorageFile file in result) diff --git a/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs b/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs index 3a5b7c6b7..9ee2aacf2 100644 --- a/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs +++ b/src/Ryujinx/UI/Views/User/UserProfileImageSelectorView.axaml.cs @@ -4,10 +4,12 @@ using Avalonia.Platform.Storage; using Avalonia.VisualTree; using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Navigation; +using Gommon; using Ryujinx.Ava.Common.Locale; using Ryujinx.Ava.UI.Controls; using Ryujinx.Ava.UI.Models; using Ryujinx.Ava.UI.ViewModels; +using Ryujinx.Ava.Utilities; using Ryujinx.HLE.FileSystem; using SkiaSharp; using System.Collections.Generic; @@ -62,7 +64,7 @@ namespace Ryujinx.Ava.UI.Views.User private async void Import_OnClick(object sender, RoutedEventArgs e) { - IReadOnlyList result = await ((Window)this.GetVisualRoot()!).StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions + Optional result = await ((Window)this.GetVisualRoot()!).StorageProvider.OpenSingleFilePickerAsync(new FilePickerOpenOptions { AllowMultiple = false, FileTypeFilter = new List @@ -76,9 +78,9 @@ namespace Ryujinx.Ava.UI.Views.User }, }); - if (result.Count > 0) + if (result.HasValue) { - _profile.Image = ProcessProfileImage(File.ReadAllBytes(result[0].Path.LocalPath)); + _profile.Image = ProcessProfileImage(File.ReadAllBytes(result.Value.Path.LocalPath)); _parent.GoBack(); } } diff --git a/src/Ryujinx/Utilities/StorageProviderExtensions.cs b/src/Ryujinx/Utilities/StorageProviderExtensions.cs index 2735d4336..28eed5fa5 100644 --- a/src/Ryujinx/Utilities/StorageProviderExtensions.cs +++ b/src/Ryujinx/Utilities/StorageProviderExtensions.cs @@ -29,7 +29,7 @@ namespace Ryujinx.Ava.Utilities .Then(files => files.Count > 0 ? Optional.Of(files) : default); } - private static async Task CoreDumpable(Func> picker) + public static async Task CoreDumpable(Func> picker) { OsUtils.SetCoreDumpable(true); try