diff --git a/src/LibHac/Fs/FileSystemClientUtils.cs b/src/LibHac/Fs/FileSystemClientUtils.cs index 0165f354..3a26c0df 100644 --- a/src/LibHac/Fs/FileSystemClientUtils.cs +++ b/src/LibHac/Fs/FileSystemClientUtils.cs @@ -111,13 +111,14 @@ namespace LibHac.Fs bool ignoreCase = searchOptions.HasFlag(SearchOptions.CaseInsensitive); bool recurse = searchOptions.HasFlag(SearchOptions.RecurseSubdirectories); - DirectoryEntry dirEntry = default; fs.OpenDirectory(out DirectoryHandle sourceHandle, path, OpenDirectoryMode.All).ThrowIfFailure(); using (sourceHandle) { while (true) { + DirectoryEntry dirEntry = default; + fs.ReadDirectory(out long entriesRead, SpanHelpers.AsSpan(ref dirEntry), sourceHandle); if (entriesRead == 0) break; diff --git a/src/LibHac/FsSystem/FileSystemExtensions.cs b/src/LibHac/FsSystem/FileSystemExtensions.cs index d640b39b..5b0471a5 100644 --- a/src/LibHac/FsSystem/FileSystemExtensions.cs +++ b/src/LibHac/FsSystem/FileSystemExtensions.cs @@ -79,12 +79,13 @@ namespace LibHac.FsSystem bool recurse = searchOptions.HasFlag(SearchOptions.RecurseSubdirectories); IFileSystem fs = fileSystem; - DirectoryEntry dirEntry = default; fileSystem.OpenDirectory(out IDirectory directory, path, OpenDirectoryMode.All).ThrowIfFailure(); while (true) { + DirectoryEntry dirEntry = default; + directory.Read(out long entriesRead, SpanHelpers.AsSpan(ref dirEntry)).ThrowIfFailure(); if (entriesRead == 0) break;