Don't load files from hidden subdirectories

This commit is contained in:
TSR Berry 2024-08-02 00:04:02 +02:00
parent d97e995e59
commit f9e99b4ebe
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2

View file

@ -502,7 +502,13 @@ namespace Ryujinx.UI.App.Common
try
{
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", SearchOption.AllDirectories).Where(file =>
EnumerationOptions options = new()
{
RecurseSubdirectories = true,
IgnoreInaccessible = false,
};
IEnumerable<string> 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)