mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Remove DirectoryEntryType.NotFound
This commit is contained in:
parent
7ce9ea09e6
commit
1f6046ba63
7 changed files with 9 additions and 15 deletions
|
@ -36,8 +36,7 @@ namespace LibHac.Fs
|
||||||
public enum DirectoryEntryType : byte
|
public enum DirectoryEntryType : byte
|
||||||
{
|
{
|
||||||
Directory,
|
Directory,
|
||||||
File,
|
File
|
||||||
NotFound
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
|
|
|
@ -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="entryType">If the operation returns successfully, the <see cref="DirectoryEntryType"/> of the file.</param>
|
||||||
/// <param name="path">The full path to check.</param>
|
/// <param name="path">The full path to check.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
/// <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);
|
Result GetEntryType(out DirectoryEntryType entryType, string path);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -75,14 +75,14 @@ namespace LibHac.FsSystem
|
||||||
{
|
{
|
||||||
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
|
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
|
||||||
|
|
||||||
if (getEntryResult.IsSuccess() && type != DirectoryEntryType.NotFound)
|
if (getEntryResult.IsSuccess())
|
||||||
{
|
{
|
||||||
entryType = type;
|
entryType = type;
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entryType = DirectoryEntryType.NotFound;
|
entryType = default;
|
||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ namespace LibHac.FsSystem
|
||||||
{
|
{
|
||||||
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
|
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
|
||||||
|
|
||||||
if (getEntryResult.IsSuccess() && type != DirectoryEntryType.NotFound)
|
if (getEntryResult.IsSuccess())
|
||||||
{
|
{
|
||||||
return fs.GetFileTimeStampRaw(out timeStamp, path);
|
return fs.GetFileTimeStampRaw(out timeStamp, path);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ namespace LibHac.FsSystem
|
||||||
{
|
{
|
||||||
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
|
Result getEntryResult = fs.GetEntryType(out DirectoryEntryType type, path);
|
||||||
|
|
||||||
if (getEntryResult.IsSuccess() && type != DirectoryEntryType.NotFound)
|
if (getEntryResult.IsSuccess())
|
||||||
{
|
{
|
||||||
return fs.QueryEntry(outBuffer, inBuffer, queryId, path);
|
return fs.QueryEntry(outBuffer, inBuffer, queryId, path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ namespace LibHac.FsSystem
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
entryType = DirectoryEntryType.NotFound;
|
entryType = default;
|
||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace LibHac.FsSystem
|
||||||
|
|
||||||
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path)
|
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path)
|
||||||
{
|
{
|
||||||
entryType = DirectoryEntryType.NotFound;
|
entryType = default;
|
||||||
path = PathTools.Normalize(path);
|
path = PathTools.Normalize(path);
|
||||||
|
|
||||||
if (path == "/")
|
if (path == "/")
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace LibHac.FsSystem.RomFs
|
||||||
|
|
||||||
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path)
|
protected override Result GetEntryTypeImpl(out DirectoryEntryType entryType, string path)
|
||||||
{
|
{
|
||||||
entryType = DirectoryEntryType.NotFound;
|
entryType = default;
|
||||||
path = PathTools.Normalize(path);
|
path = PathTools.Normalize(path);
|
||||||
|
|
||||||
if (FileTable.TryOpenFile(path, out RomFileInfo _))
|
if (FileTable.TryOpenFile(path, out RomFileInfo _))
|
||||||
|
|
|
@ -178,7 +178,7 @@ namespace LibHac.FsSystem.Save
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
entryType = DirectoryEntryType.NotFound;
|
entryType = default;
|
||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue