Remove DirectoryEntryType.NotFound

This commit is contained in:
Alex Barney 2020-03-02 16:14:02 -07:00
parent 7ce9ea09e6
commit 1f6046ba63
7 changed files with 9 additions and 15 deletions

View file

@ -36,8 +36,7 @@ namespace LibHac.Fs
public enum DirectoryEntryType : byte
{
Directory,
File,
NotFound
File
}
[Flags]

View file

@ -127,11 +127,6 @@ namespace LibHac.Fs
/// <param name="entryType">If the operation returns successfully, the <see cref="DirectoryEntryType"/> of the file.</param>
/// <param name="path">The full path to check.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// This function operates slightly differently than it does in Horizon OS.
/// Instead of returning <see cref="ResultFs.PathNotFound"/> when an entry is missing,
/// the function will return <see cref="DirectoryEntryType.NotFound"/>.
/// </remarks>
Result GetEntryType(out DirectoryEntryType entryType, string path);
/// <summary>

View file

@ -75,14 +75,14 @@ namespace LibHac.FsSystem
{
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
if (getEntryResult.IsSuccess() && type != DirectoryEntryType.NotFound)
if (getEntryResult.IsSuccess())
{
entryType = type;
return Result.Success;
}
}
entryType = DirectoryEntryType.NotFound;
entryType = default;
return ResultFs.PathNotFound.Log();
}
@ -94,7 +94,7 @@ namespace LibHac.FsSystem
{
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
if (getEntryResult.IsSuccess() && type != DirectoryEntryType.NotFound)
if (getEntryResult.IsSuccess())
{
return fs.GetFileTimeStampRaw(out timeStamp, path);
}
@ -112,7 +112,7 @@ namespace LibHac.FsSystem
{
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
if (getEntryResult.IsSuccess() && type != DirectoryEntryType.NotFound)
if (getEntryResult.IsSuccess())
{
return fs.QueryEntry(outBuffer, inBuffer, queryId, path);
}

View file

@ -308,7 +308,7 @@ namespace LibHac.FsSystem
return Result.Success;
}
entryType = DirectoryEntryType.NotFound;
entryType = default;
return ResultFs.PathNotFound.Log();
}

View file

@ -57,7 +57,7 @@ namespace LibHac.FsSystem
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path)
{
entryType = DirectoryEntryType.NotFound;
entryType = default;
path = PathTools.Normalize(path);
if (path == "/")

View file

@ -24,7 +24,7 @@ namespace LibHac.FsSystem.RomFs
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path)
{
entryType = DirectoryEntryType.NotFound;
entryType = default;
path = PathTools.Normalize(path);
if (FileTable.TryOpenFile(path, out RomFileInfo _))

View file

@ -178,7 +178,7 @@ namespace LibHac.FsSystem.Save
return Result.Success;
}
entryType = DirectoryEntryType.NotFound;
entryType = default;
return ResultFs.PathNotFound.Log();
}