Fix unhandled UnauthorizedAccessException causing crash while listing directories

This commit is contained in:
EliseZeroTwo 2020-03-24 18:41:54 +01:00
commit f4ec4a5b0e

View file

@ -51,6 +51,8 @@ namespace Ryujinx.Ui
// Builds the applications list with paths to found applications // Builds the applications list with paths to found applications
List<string> applications = new List<string>(); List<string> applications = new List<string>();
foreach (string appDir in appDirs) foreach (string appDir in appDirs)
{
try
{ {
if (!Directory.Exists(appDir)) if (!Directory.Exists(appDir))
{ {
@ -68,10 +70,13 @@ namespace Ryujinx.Ui
(Path.GetExtension(app).ToLower() == ".nro") || (Path.GetExtension(app).ToLower() == ".nro") ||
(Path.GetExtension(app).ToLower() == ".nso")) (Path.GetExtension(app).ToLower() == ".nso"))
{ {
applications.Add(app); applications.Add(app);
numApplicationsFound++; numApplicationsFound++;
} }
} }
} catch (UnauthorizedAccessException) { }
} }
// Loops through applications list, creating a struct and then firing an event containing the struct for each application // Loops through applications list, creating a struct and then firing an event containing the struct for each application