|
|
@@ -40,6 +40,47 @@ namespace Ryujinx.Ui
|
|
|
private static Language _desiredTitleLanguage;
|
|
|
private static bool _loadingError;
|
|
|
|
|
|
+ public static IEnumerable<string> GetFilesInDirectory(string directory)
|
|
|
+ {
|
|
|
+ Stack<string> stack = new Stack<string>();
|
|
|
+ stack.Push(directory);
|
|
|
+ while (stack.Count > 0)
|
|
|
+ {
|
|
|
+ string dir = stack.Pop();
|
|
|
+ string[] content = { };
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ content = Directory.GetFiles(dir, "*");
|
|
|
+ }
|
|
|
+ catch (UnauthorizedAccessException)
|
|
|
+ {
|
|
|
+ Logger.PrintWarning(LogClass.Application, $"Failed to get access to directory: \"{dir}\"");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.Length > 0)
|
|
|
+ {
|
|
|
+ foreach (string file in content)
|
|
|
+ yield return file;
|
|
|
+ }
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ content = Directory.GetDirectories(dir);
|
|
|
+ }
|
|
|
+ catch (UnauthorizedAccessException)
|
|
|
+ {
|
|
|
+ Logger.PrintWarning(LogClass.Application, $"Failed to get access to directory: \"{dir}\"");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.Length > 0)
|
|
|
+ {
|
|
|
+ foreach (string subdir in content)
|
|
|
+ stack.Push(subdir);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static void LoadApplications(List<string> appDirs, VirtualFileSystem virtualFileSystem, Language desiredTitleLanguage)
|
|
|
{
|
|
|
int numApplicationsFound = 0;
|
|
|
@@ -53,6 +94,7 @@ namespace Ryujinx.Ui
|
|
|
List<string> applications = new List<string>();
|
|
|
foreach (string appDir in appDirs)
|
|
|
{
|
|
|
+
|
|
|
if (!Directory.Exists(appDir))
|
|
|
{
|
|
|
Logger.PrintWarning(LogClass.Application, $"The \"game_dirs\" section in \"Config.json\" contains an invalid directory: \"{appDir}\"");
|
|
|
@@ -60,10 +102,10 @@ namespace Ryujinx.Ui
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- foreach (string app in Directory.GetFiles(appDir, "*.*", SearchOption.AllDirectories))
|
|
|
+ foreach (string app in GetFilesInDirectory(appDir))
|
|
|
{
|
|
|
if ((Path.GetExtension(app).ToLower() == ".nsp") ||
|
|
|
- (Path.GetExtension(app).ToLower() == ".pfs0")||
|
|
|
+ (Path.GetExtension(app).ToLower() == ".pfs0") ||
|
|
|
(Path.GetExtension(app).ToLower() == ".xci") ||
|
|
|
(Path.GetExtension(app).ToLower() == ".nca") ||
|
|
|
(Path.GetExtension(app).ToLower() == ".nro") ||
|