mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Avoid running into problems from a GC hole in runtimes that don't support fast span.
Support for .NET Framework probably needs to be removed soon. Having runtime support for CreateSpan has turned out to be rather useful.
This commit is contained in:
parent
2f6b75a8eb
commit
abce62dd4f
2 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue