From f9e99b4ebe98e0542f41c0727a49b3219667fea2 Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Fri, 2 Aug 2024 00:04:02 +0200 Subject: [PATCH] Don't load files from hidden subdirectories --- .../App/ApplicationLibrary.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs index e7c48162aa..bf9682ebdb 100644 --- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs +++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs @@ -502,7 +502,13 @@ namespace Ryujinx.UI.App.Common try { - IEnumerable files = Directory.EnumerateFiles(appDir, "*", SearchOption.AllDirectories).Where(file => + EnumerationOptions options = new() + { + RecurseSubdirectories = true, + IgnoreInaccessible = false, + }; + + IEnumerable files = Directory.EnumerateFiles(appDir, "*", options).Where(file => { return (Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.UI.ShownFileTypes.NSP.Value) || @@ -521,14 +527,10 @@ namespace Ryujinx.UI.App.Common } var fileInfo = new FileInfo(app); - string extension = fileInfo.Extension.ToLower(); + var fullPath = fileInfo.ResolveLinkTarget(true)?.FullName ?? fileInfo.FullName; - if (!fileInfo.Attributes.HasFlag(FileAttributes.Hidden) && extension is ".nsp" or ".pfs0" or ".xci" or ".nca" or ".nro" or ".nso") - { - var fullPath = fileInfo.ResolveLinkTarget(true)?.FullName ?? fileInfo.FullName; - applicationPaths.Add(fullPath); - numApplicationsFound++; - } + applicationPaths.Add(fullPath); + numApplicationsFound++; } } catch (UnauthorizedAccessException)