mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2025-02-09 13:14:46 +01:00
Update IFileSystem for nnsdk 12.x
This commit is contained in:
parent
b7897c8553
commit
7d3ceb5315
@ -143,10 +143,14 @@ namespace LibHac.Fs
|
||||
|
||||
public enum OperationId
|
||||
{
|
||||
Clear = 0,
|
||||
ClearSignature = 1,
|
||||
FillZero = 0,
|
||||
DestroySignature = 1,
|
||||
InvalidateCache = 2,
|
||||
QueryRange = 3
|
||||
QueryRange = 3,
|
||||
QueryUnpreparedRange = 4,
|
||||
QueryLazyLoadCompletionRate = 5,
|
||||
SetLazyLoadPriority = 6,
|
||||
ReadyLazyLoadFile = 10001
|
||||
}
|
||||
|
||||
public enum SaveDataType : byte
|
||||
|
@ -17,23 +17,16 @@ namespace LibHac.Fs.Fsa
|
||||
/// <param name="size">The initial size of the created file.</param>
|
||||
/// <param name="option">Flags to control how the file is created.
|
||||
/// Should usually be <see cref="CreateFileOptions.None"/></param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The parent directory of the specified path does not exist: <see cref="ResultFs.PathNotFound"/>
|
||||
/// Specified path already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
|
||||
/// Insufficient free space to create the file: <see cref="ResultFs.UsableSpaceNotEnough"/>
|
||||
/// </remarks>
|
||||
public Result CreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
||||
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the file.</returns>
|
||||
public Result CreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
if (size < 0)
|
||||
return ResultFs.OutOfRange.Log();
|
||||
|
||||
return DoCreateFile(path, size, option);
|
||||
return DoCreateFile(in path, size, option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -42,141 +35,88 @@ namespace LibHac.Fs.Fsa
|
||||
/// <param name="path">The full path of the file to create.</param>
|
||||
/// <param name="size">The initial size of the created file.
|
||||
/// Should usually be <see cref="CreateFileOptions.None"/></param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The parent directory of the specified path does not exist: <see cref="ResultFs.PathNotFound"/>
|
||||
/// Specified path already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
|
||||
/// Insufficient free space to create the file: <see cref="ResultFs.UsableSpaceNotEnough"/>
|
||||
/// </remarks>
|
||||
public Result CreateFile(U8Span path, long size)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
||||
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the file.</returns>
|
||||
public Result CreateFile(in Path path, long size)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
if (size < 0)
|
||||
return ResultFs.OutOfRange.Log();
|
||||
|
||||
return DoCreateFile(path, size, CreateFileOptions.None);
|
||||
return CreateFile(in path, size, CreateFileOptions.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified file.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path of the file to delete.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The specified path does not exist or is a directory: <see cref="ResultFs.PathNotFound"/>
|
||||
/// </remarks>
|
||||
public Result DeleteFile(U8Span path)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.</returns>
|
||||
public Result DeleteFile(in Path path)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoDeleteFile(path);
|
||||
return DoDeleteFile(in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates all directories and subdirectories in the specified path unless they already exist.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path of the directory to create.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The parent directory of the specified path does not exist: <see cref="ResultFs.PathNotFound"/>
|
||||
/// Specified path already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
|
||||
/// Insufficient free space to create the directory: <see cref="ResultFs.UsableSpaceNotEnough"/>
|
||||
/// </remarks>
|
||||
public Result CreateDirectory(U8Span path)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
||||
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the directory.</returns>
|
||||
public Result CreateDirectory(in Path path)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoCreateDirectory(path);
|
||||
return DoCreateDirectory(in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified directory.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path of the directory to delete.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
|
||||
/// The specified directory is not empty: <see cref="ResultFs.DirectoryNotEmpty"/>
|
||||
/// </remarks>
|
||||
public Result DeleteDirectory(U8Span path)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.<br/>
|
||||
/// <see cref="ResultFs.DirectoryNotEmpty"/>: The specified directory is not empty.</returns>
|
||||
public Result DeleteDirectory(in Path path)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoDeleteDirectory(path);
|
||||
return DoDeleteDirectory(in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes the specified directory and any subdirectories and files in the directory.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path of the directory to delete.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
|
||||
/// </remarks>
|
||||
public Result DeleteDirectoryRecursively(U8Span path)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
||||
public Result DeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoDeleteDirectoryRecursively(path);
|
||||
return DoDeleteDirectoryRecursively(in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes any subdirectories and files in the specified directory.
|
||||
/// </summary>
|
||||
/// <param name="path">The full path of the directory to clean.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
|
||||
/// </remarks>
|
||||
public Result CleanDirectoryRecursively(U8Span path)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
||||
public Result CleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoCleanDirectoryRecursively(path);
|
||||
return DoCleanDirectoryRecursively(in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renames or moves a file to a new location.
|
||||
/// </summary>
|
||||
/// <param name="currentPath">The full path of the file to rename.</param>
|
||||
/// <param name="currentPath">The current full path of the file to rename.</param>
|
||||
/// <param name="newPath">The new full path of the file.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: <paramref name="currentPath"/> does not exist or is a directory.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: <paramref name="newPath"/>'s parent directory does not exist.<br/>
|
||||
/// <see cref="ResultFs.PathAlreadyExists"/>: <paramref name="newPath"/> already exists as either a file or directory.</returns>
|
||||
/// <remarks>
|
||||
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns successfully.
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// <paramref name="currentPath"/> does not exist or is a directory: <see cref="ResultFs.PathNotFound"/>
|
||||
/// <paramref name="newPath"/>'s parent directory does not exist: <see cref="ResultFs.PathNotFound"/>
|
||||
/// <paramref name="newPath"/> already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
|
||||
/// </remarks>
|
||||
public Result RenameFile(U8Span currentPath, U8Span newPath)
|
||||
public Result RenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
if (currentPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
if (newPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoRenameFile(currentPath, newPath);
|
||||
return DoRenameFile(in currentPath, in newPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -184,33 +124,38 @@ namespace LibHac.Fs.Fsa
|
||||
/// </summary>
|
||||
/// <param name="currentPath">The full path of the directory to rename.</param>
|
||||
/// <param name="newPath">The new full path of the directory.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: <paramref name="currentPath"/> does not exist or is a file.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: <paramref name="newPath"/>'s parent directory does not exist.<br/>
|
||||
/// <see cref="ResultFs.PathAlreadyExists"/>: <paramref name="newPath"/> already exists as either a file or directory.<br/>
|
||||
/// <see cref="ResultFs.DirectoryNotRenamable"/>: Either <paramref name="currentPath"/> or <paramref name="newPath"/> is a subpath of the other.</returns>
|
||||
/// <remarks>
|
||||
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns <see cref="Result.Success"/>.
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// <paramref name="currentPath"/> does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
|
||||
/// <paramref name="newPath"/>'s parent directory does not exist: <see cref="ResultFs.PathNotFound"/>
|
||||
/// <paramref name="newPath"/> already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
|
||||
/// Either <paramref name="currentPath"/> or <paramref name="newPath"/> is a subpath of the other: <see cref="ResultFs.DirectoryNotRenamable"/>
|
||||
/// </remarks>
|
||||
public Result RenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
public Result RenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
if (currentPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
if (newPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoRenameDirectory(currentPath, newPath);
|
||||
return DoRenameDirectory(in currentPath, in newPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified path is a file or directory, or does not exist.
|
||||
/// </summary>
|
||||
/// <param name="entryType">If the operation returns successfully, the <see cref="DirectoryEntryType"/> of the file.</param>
|
||||
/// <param name="entryType">If the operation returns successfully, contains 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>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist.</returns>
|
||||
public Result GetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
return DoGetEntryType(out entryType, in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified path is a file or directory, or does not exist.
|
||||
/// </summary>
|
||||
/// <param name="entryType">If the operation returns successfully, contains the <see cref="DirectoryEntryType"/> of the file.</param>
|
||||
/// <param name="path">The full path to check.</param>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist.</returns>
|
||||
public Result GetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
@ -218,7 +163,11 @@ namespace LibHac.Fs.Fsa
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoGetEntryType(out entryType, path);
|
||||
var pathNormalized = new Path();
|
||||
Result rs = pathNormalized.InitializeWithNormalization(path);
|
||||
if (rs.IsFailure()) return rs;
|
||||
|
||||
return DoGetEntryType(out entryType, in pathNormalized);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -227,14 +176,9 @@ namespace LibHac.Fs.Fsa
|
||||
/// <param name="freeSpace">If the operation returns successfully, the amount of free space available on the drive, in bytes.</param>
|
||||
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
public Result GetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
public Result GetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoGetFreeSpaceSize(out freeSpace, path);
|
||||
return DoGetFreeSpaceSize(out freeSpace, in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -243,14 +187,9 @@ namespace LibHac.Fs.Fsa
|
||||
/// <param name="totalSpace">If the operation returns successfully, the total size of the drive, in bytes.</param>
|
||||
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
public Result GetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
public Result GetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoGetTotalSpaceSize(out totalSpace, path);
|
||||
return DoGetTotalSpaceSize(out totalSpace, in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -260,33 +199,44 @@ namespace LibHac.Fs.Fsa
|
||||
/// An <see cref="IFile"/> instance for the specified path.</param>
|
||||
/// <param name="path">The full path of the file to open.</param>
|
||||
/// <param name="mode">Specifies the access permissions of the created <see cref="IFile"/>.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The specified path does not exist or is a directory: <see cref="ResultFs.PathNotFound"/>
|
||||
/// </remarks>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.<br/>
|
||||
/// <see cref="ResultFs.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
||||
/// the file is already opened as <see cref="OpenMode.Write"/>.</returns>
|
||||
public Result OpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
if (path.IsNull())
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
}
|
||||
|
||||
if ((mode & OpenMode.ReadWrite) == 0)
|
||||
var pathNormalized = new Path();
|
||||
Result rs = pathNormalized.InitializeWithNormalization(path);
|
||||
if (rs.IsFailure()) return rs;
|
||||
|
||||
return DoOpenFile(out file, in pathNormalized, mode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens an <see cref="IFile"/> instance for the specified path.
|
||||
/// </summary>
|
||||
/// <param name="file">If the operation returns successfully,
|
||||
/// An <see cref="IFile"/> instance for the specified path.</param>
|
||||
/// <param name="path">The full path of the file to open.</param>
|
||||
/// <param name="mode">Specifies the access permissions of the created <see cref="IFile"/>.</param>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.<br/>
|
||||
/// <see cref="ResultFs.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
||||
/// the file is already opened as <see cref="OpenMode.Write"/>.</returns>
|
||||
public Result OpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
if ((mode & OpenMode.ReadWrite) == 0 || (mode & ~OpenMode.All) != 0)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
return ResultFs.InvalidOpenMode.Log();
|
||||
}
|
||||
|
||||
if ((mode & ~OpenMode.All) != 0)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
return ResultFs.InvalidOpenMode.Log();
|
||||
}
|
||||
|
||||
return DoOpenFile(out file, path, mode);
|
||||
return DoOpenFile(out file, in path, mode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -296,33 +246,18 @@ namespace LibHac.Fs.Fsa
|
||||
/// An <see cref="IDirectory"/> instance for the specified directory.</param>
|
||||
/// <param name="path">The directory's full path.</param>
|
||||
/// <param name="mode">Specifies which sub-entries should be enumerated.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
|
||||
/// </remarks>
|
||||
public Result OpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
||||
public Result OpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
if (path.IsNull())
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
}
|
||||
|
||||
if ((mode & OpenDirectoryMode.All) == 0)
|
||||
if ((mode & OpenDirectoryMode.All) == 0 ||
|
||||
(mode & ~(OpenDirectoryMode.All | OpenDirectoryMode.NoFileSize)) != 0)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
return ResultFs.InvalidOpenMode.Log();
|
||||
}
|
||||
|
||||
if ((mode & ~(OpenDirectoryMode.All | OpenDirectoryMode.NoFileSize)) != 0)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
return ResultFs.InvalidOpenMode.Log();
|
||||
}
|
||||
|
||||
return DoOpenDirectory(out directory, path, mode);
|
||||
return DoOpenDirectory(out directory, in path, mode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -344,21 +279,11 @@ namespace LibHac.Fs.Fsa
|
||||
/// <param name="timeStamp">If the operation returns successfully, the timestamps for the specified file or directory.
|
||||
/// These value are expressed as Unix timestamps.</param>
|
||||
/// <param name="path">The path of the file or directory.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
/// <remarks>
|
||||
/// The following <see cref="Result"/> codes may be returned under certain conditions:
|
||||
///
|
||||
/// The specified path does not exist: <see cref="ResultFs.PathNotFound"/>
|
||||
/// </remarks>
|
||||
public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist.</returns>
|
||||
public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
if (path.IsNull())
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
}
|
||||
|
||||
return DoGetFileTimeStampRaw(out timeStamp, path);
|
||||
return DoGetFileTimeStampRaw(out timeStamp, in path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -373,60 +298,51 @@ namespace LibHac.Fs.Fsa
|
||||
/// <param name="queryId">The type of query to perform.</param>
|
||||
/// <param name="path">The full path of the file to query.</param>
|
||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||
public Result QueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId, U8Span path)
|
||||
public Result QueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId, in Path path)
|
||||
{
|
||||
if (path.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoQueryEntry(outBuffer, inBuffer, queryId, path);
|
||||
}
|
||||
|
||||
protected abstract Result DoCreateFile(U8Span path, long size, CreateFileOptions option);
|
||||
protected abstract Result DoDeleteFile(U8Span path);
|
||||
protected abstract Result DoCreateDirectory(U8Span path);
|
||||
protected abstract Result DoDeleteDirectory(U8Span path);
|
||||
protected abstract Result DoDeleteDirectoryRecursively(U8Span path);
|
||||
protected abstract Result DoCleanDirectoryRecursively(U8Span path);
|
||||
protected abstract Result DoRenameFile(U8Span currentPath, U8Span newPath);
|
||||
protected abstract Result DoRenameDirectory(U8Span currentPath, U8Span newPath);
|
||||
protected abstract Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path);
|
||||
protected abstract Result DoCreateFile(in Path path, long size, CreateFileOptions option);
|
||||
protected abstract Result DoDeleteFile(in Path path);
|
||||
protected abstract Result DoCreateDirectory(in Path path);
|
||||
protected abstract Result DoDeleteDirectory(in Path path);
|
||||
protected abstract Result DoDeleteDirectoryRecursively(in Path path);
|
||||
protected abstract Result DoCleanDirectoryRecursively(in Path path);
|
||||
protected abstract Result DoRenameFile(in Path currentPath, in Path newPath);
|
||||
protected abstract Result DoRenameDirectory(in Path currentPath, in Path newPath);
|
||||
protected abstract Result DoGetEntryType(out DirectoryEntryType entryType, in Path path);
|
||||
|
||||
protected virtual Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected virtual Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
return ResultFs.NotImplemented.Log();
|
||||
}
|
||||
|
||||
protected virtual Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected virtual Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
return ResultFs.NotImplemented.Log();
|
||||
}
|
||||
|
||||
protected abstract Result DoOpenFile(out IFile file, U8Span path, OpenMode mode);
|
||||
protected abstract Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode);
|
||||
protected abstract Result DoOpenFile(out IFile file, in Path path, OpenMode mode);
|
||||
protected abstract Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode);
|
||||
protected abstract Result DoCommit();
|
||||
|
||||
protected virtual Result DoCommitProvisionally(long counter) => ResultFs.NotImplemented.Log();
|
||||
protected virtual Result DoRollback() => ResultFs.NotImplemented.Log();
|
||||
protected virtual Result DoFlush() => ResultFs.NotImplemented.Log();
|
||||
|
||||
protected virtual Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected virtual Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
return ResultFs.NotImplemented.Log();
|
||||
}
|
||||
|
||||
protected virtual Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path) => ResultFs.NotImplemented.Log();
|
||||
in Path path) => ResultFs.NotImplemented.Log();
|
||||
|
||||
protected virtual void Dispose(bool disposing) { }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
public virtual void Dispose() { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -460,6 +376,9 @@ namespace LibHac.Fs.Fsa
|
||||
/// Turns a folder in a <see cref="ConcatenationFileSystem"/> into a concatenation file by
|
||||
/// setting the directory's archive flag.
|
||||
/// </summary>
|
||||
MakeConcatFile = 0
|
||||
SetConcatenationFileAttribute = 0,
|
||||
UpdateMac = 1,
|
||||
IsSignedSystemPartitionOnSdCardValid = 2,
|
||||
QueryUnpreparedFileInformation = 3
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace LibHac.Fs.Fsa
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = fileSystem.QueryEntry(Span<byte>.Empty, ReadOnlySpan<byte>.Empty, QueryId.MakeConcatFile, subPath);
|
||||
rc = fileSystem.QueryEntry(Span<byte>.Empty, ReadOnlySpan<byte>.Empty, QueryId.SetConcatenationFileAttribute, subPath);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ namespace LibHac.Fs.Impl
|
||||
BaseFs = baseFileSystem.AddReference();
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -31,7 +31,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.CreateFile(in sfPath, size, (int)option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -39,7 +39,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.DeleteFile(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -47,7 +47,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.DeleteFile(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -55,7 +55,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.DeleteDirectory(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -63,7 +63,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.DeleteDirectoryRecursively(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -71,7 +71,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.CleanDirectoryRecursively(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf oldSfPath, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -82,7 +82,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.RenameFile(in oldSfPath, in newSfPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf oldSfPath, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -93,7 +93,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.RenameDirectory(in oldSfPath, in newSfPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -105,7 +105,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.GetEntryType(out sfEntryType, in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
@ -115,7 +115,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.GetFreeSpaceSize(out freeSpace, in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
@ -125,7 +125,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.GetTotalSpaceSize(out totalSpace, in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -147,7 +147,7 @@ namespace LibHac.Fs.Impl
|
||||
}
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -174,7 +174,7 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.Target.Commit();
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
@ -185,7 +185,7 @@ namespace LibHac.Fs.Impl
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path)
|
||||
in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -198,14 +198,10 @@ namespace LibHac.Fs.Impl
|
||||
return BaseFs.AddReference();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
BaseFs?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
BaseFs?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private Result GetPathForServiceObject(out PathSf sfPath, U8Span path)
|
||||
|
@ -21,7 +21,7 @@ namespace LibHac.Fs
|
||||
FsTable = new FileTable();
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
Result rc = PathNormalizer.Normalize(normalizedPath.Str, out _, path, false, false);
|
||||
@ -46,7 +46,7 @@ namespace LibHac.Fs
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
Result rc = PathNormalizer.Normalize(normalizedPath.Str, out _, path, false, false);
|
||||
@ -61,7 +61,7 @@ namespace LibHac.Fs
|
||||
return file.File.SetSize(size);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
Result rc = PathNormalizer.Normalize(normalizedPath.Str, out _, path, false, false);
|
||||
@ -70,7 +70,7 @@ namespace LibHac.Fs
|
||||
return FsTable.DeleteDirectory(normalizedPath, false);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
Result rc = PathNormalizer.Normalize(normalizedPath.Str, out _, path, false, false);
|
||||
@ -79,7 +79,7 @@ namespace LibHac.Fs
|
||||
return FsTable.DeleteDirectory(normalizedPath, true);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
Result rc = PathNormalizer.Normalize(normalizedPath.Str, out _, path, false, false);
|
||||
@ -88,7 +88,7 @@ namespace LibHac.Fs
|
||||
return FsTable.CleanDirectory(normalizedPath);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
Result rc = PathNormalizer.Normalize(normalizedPath.Str, out _, path, false, false);
|
||||
@ -97,7 +97,7 @@ namespace LibHac.Fs
|
||||
return FsTable.DeleteFile(normalizedPath);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -112,7 +112,7 @@ namespace LibHac.Fs
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -128,7 +128,7 @@ namespace LibHac.Fs
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath normalizedNewPath);
|
||||
@ -142,7 +142,7 @@ namespace LibHac.Fs
|
||||
return FsTable.RenameDirectory(normalizedCurrentPath, normalizedNewPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath normalizedNewPath);
|
||||
@ -156,7 +156,7 @@ namespace LibHac.Fs
|
||||
return FsTable.RenameFile(normalizedCurrentPath, normalizedNewPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem;
|
||||
|
||||
@ -18,7 +17,7 @@ namespace LibHac.FsSrv.Impl
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantOverriddenMember
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
// Todo: Implement
|
||||
return base.DoOpenFile(out file, path, mode);
|
||||
|
@ -39,18 +39,14 @@ namespace LibHac.FsSrv.Impl
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
AccessFailureManager?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
AccessFailureManager?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantOverriddenMember
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
// Todo: Implement
|
||||
return base.DoOpenFile(out file, path, mode);
|
||||
|
@ -104,65 +104,61 @@ namespace LibHac.FsSrv.Impl
|
||||
BaseFileSystem = Shared.Move(ref baseFileSystem);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
BaseFileSystem?.Dispose();
|
||||
BaseFileSystem = null;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
BaseFileSystem?.Dispose();
|
||||
BaseFileSystem = null;
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.CreateFile(path, size, option));
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.DeleteFile(path));
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.CreateDirectory(path));
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.DeleteDirectory(path));
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.DeleteDirectoryRecursively(path));
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.CleanDirectoryRecursively(path));
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.RenameFile(currentPath, newPath));
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.RenameDirectory(currentPath, newPath));
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.GetEntryType(out entryType, path));
|
||||
}
|
||||
|
||||
protected abstract override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode);
|
||||
protected abstract override Result DoOpenFile(out IFile file, in Path path, OpenMode mode);
|
||||
|
||||
protected abstract override Result DoOpenDirectory(out IDirectory directory, U8Span path,
|
||||
protected abstract override Result DoOpenDirectory(out IDirectory directory, in Path path,
|
||||
OpenDirectoryMode mode);
|
||||
|
||||
protected override Result DoCommit()
|
||||
@ -185,23 +181,23 @@ namespace LibHac.FsSrv.Impl
|
||||
return ConvertResult(BaseFileSystem.Target.Flush());
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.GetFileTimeStampRaw(out timeStamp, path));
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path)
|
||||
in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.QueryEntry(outBuffer, inBuffer, queryId, path));
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.GetFreeSpaceSize(out freeSpace, path));
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.GetTotalSpaceSize(out totalSpace, path));
|
||||
}
|
||||
|
@ -47,28 +47,24 @@ namespace LibHac.FsSrv.Impl
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantOverriddenMember
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
// Todo: Implement
|
||||
return base.DoOpenFile(out file, path, mode);
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantOverriddenMember
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
// Todo: Implement
|
||||
return base.DoOpenDirectory(out directory, path, mode);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_entryCountSemaphore?.Dispose();
|
||||
_mountCountSemaphore?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
_entryCountSemaphore?.Dispose();
|
||||
_mountCountSemaphore?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ namespace LibHac.FsSrv.Impl
|
||||
return new ReferenceCountedDisposable<IFileSystem>(resultConvertFileSystem);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -187,7 +187,7 @@ namespace LibHac.FsSrv.Impl
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
|
@ -33,22 +33,18 @@ namespace LibHac.FsSystem
|
||||
BlockSize = blockSize;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
SharedBaseFileSystem?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
SharedBaseFileSystem?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
return BaseFileSystem.CreateDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
return CreateFile(path, size, option, new byte[0x20]);
|
||||
}
|
||||
@ -82,27 +78,27 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
return BaseFileSystem.DeleteDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
return BaseFileSystem.DeleteDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
return BaseFileSystem.CleanDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
return BaseFileSystem.DeleteFile(path);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -113,7 +109,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -126,7 +122,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
// todo: Return proper result codes
|
||||
|
||||
@ -186,7 +182,7 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
// todo: Return proper result codes
|
||||
|
||||
@ -210,22 +206,22 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
return BaseFileSystem.GetEntryType(out entryType, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
return BaseFileSystem.GetFileTimeStampRaw(out timeStamp, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
return BaseFileSystem.GetFreeSpaceSize(out freeSpace, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
return BaseFileSystem.GetTotalSpaceSize(out totalSpace, path);
|
||||
}
|
||||
@ -246,7 +242,7 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path)
|
||||
in Path path)
|
||||
{
|
||||
return BaseFileSystem.QueryEntry(outBuffer, inBuffer, queryId, path);
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
|
||||
@ -7,57 +6,57 @@ namespace LibHac.FsSystem
|
||||
{
|
||||
public class ApplicationTemporaryFileSystem : IFileSystem, ISaveDataExtraDataAccessor
|
||||
{
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.SetFileAttributes(path, NxFileAttributes.Archive);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
var parent = new U8Span(PathTools.GetParentDirectory(path));
|
||||
|
||||
@ -112,7 +112,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.CreateDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
CreateFileOptions newOptions = option & ~CreateFileOptions.CreateConcatenationFile;
|
||||
|
||||
@ -158,7 +158,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
if (IsConcatenationFile(path))
|
||||
{
|
||||
@ -168,21 +168,21 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.DeleteDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
if (IsConcatenationFile(path)) return ResultFs.PathNotFound.Log();
|
||||
|
||||
return BaseFileSystem.DeleteDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
if (IsConcatenationFile(path)) return ResultFs.PathNotFound.Log();
|
||||
|
||||
return BaseFileSystem.CleanDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
if (!IsConcatenationFile(path))
|
||||
{
|
||||
@ -206,7 +206,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.DeleteDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -222,7 +222,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -253,7 +253,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
if (IsConcatenationFile(currentPath))
|
||||
{
|
||||
@ -263,7 +263,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.RenameDirectory(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
if (IsConcatenationFile(currentPath))
|
||||
{
|
||||
@ -275,7 +275,7 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
if (IsConcatenationFile(path))
|
||||
{
|
||||
@ -286,17 +286,17 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.GetEntryType(out entryType, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
return BaseFileSystem.GetFreeSpaceSize(out freeSpace, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
return BaseFileSystem.GetTotalSpaceSize(out totalSpace, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
return BaseFileSystem.GetFileTimeStampRaw(out timeStamp, path);
|
||||
}
|
||||
@ -317,9 +317,9 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path)
|
||||
in Path path)
|
||||
{
|
||||
if (queryId != QueryId.MakeConcatFile) return ResultFs.UnsupportedQueryEntryForConcatenationFileSystem.Log();
|
||||
if (queryId != QueryId.SetConcatenationFileAttribute) return ResultFs.UnsupportedQueryEntryForConcatenationFileSystem.Log();
|
||||
|
||||
return SetConcatenationFileAttribute(path);
|
||||
}
|
||||
|
@ -186,14 +186,14 @@ namespace LibHac.FsSystem
|
||||
_fsClient = fsClient;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
_lockFile?.Dispose();
|
||||
_lockFile = null;
|
||||
|
||||
_cacheObserver?.Unregister(_spaceId, _saveDataId);
|
||||
_baseFs?.Dispose();
|
||||
base.Dispose(disposing);
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public Result Initialize(bool isJournalingSupported, bool isMultiCommitSupported, bool isJournalingEnabled)
|
||||
@ -299,7 +299,7 @@ namespace LibHac.FsSystem
|
||||
return PathNormalizer.Normalize(outPath.Slice(2), out _, relativePath, false, false);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
@ -311,7 +311,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.CreateFile(fullPath, size, option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
@ -323,7 +323,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.DeleteFile(fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
@ -335,7 +335,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.CreateDirectory(fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
@ -347,7 +347,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.DeleteDirectory(fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
@ -359,7 +359,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.DeleteDirectoryRecursively(fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
@ -371,7 +371,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.CleanDirectoryRecursively(fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath fullNewPath);
|
||||
@ -387,7 +387,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.RenameFile(fullCurrentPath, fullNewPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath fullNewPath);
|
||||
@ -403,7 +403,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.RenameDirectory(fullCurrentPath, fullNewPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
@ -419,7 +419,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.GetEntryType(out entryType, fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -443,7 +443,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -549,7 +549,7 @@ namespace LibHac.FsSystem
|
||||
return Initialize(_isJournalingSupported, _isMultiCommitSupported, _isJournalingEnabled);
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
@ -563,7 +563,7 @@ namespace LibHac.FsSystem
|
||||
return _baseFs.GetFreeSpaceSize(out freeSpace, fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
|
@ -202,7 +202,7 @@ namespace LibHac.FsSystem
|
||||
|
||||
public static void SetConcatenationFileAttribute(this IFileSystem fs, string path)
|
||||
{
|
||||
fs.QueryEntry(Span<byte>.Empty, Span<byte>.Empty, QueryId.MakeConcatFile, path.ToU8Span());
|
||||
fs.QueryEntry(Span<byte>.Empty, Span<byte>.Empty, QueryId.SetConcatenationFileAttribute, path.ToU8Span());
|
||||
}
|
||||
|
||||
public static void CleanDirectoryRecursivelyGeneric(IFileSystem fileSystem, string path)
|
||||
|
@ -19,50 +19,46 @@ namespace LibHac.FsSystem
|
||||
BaseFileSystem = Shared.Move(ref baseFileSystem);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
BaseFileSystem?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
BaseFileSystem?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) =>
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) =>
|
||||
BaseFileSystem.Target.CreateFile(path, size, option);
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path) => BaseFileSystem.Target.DeleteFile(path);
|
||||
protected override Result DoDeleteFile(in Path path) => BaseFileSystem.Target.DeleteFile(path);
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => BaseFileSystem.Target.CreateDirectory(path);
|
||||
protected override Result DoCreateDirectory(in Path path) => BaseFileSystem.Target.CreateDirectory(path);
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path) => BaseFileSystem.Target.DeleteDirectory(path);
|
||||
protected override Result DoDeleteDirectory(in Path path) => BaseFileSystem.Target.DeleteDirectory(path);
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path) =>
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) =>
|
||||
BaseFileSystem.Target.DeleteDirectoryRecursively(path);
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path) =>
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) =>
|
||||
BaseFileSystem.Target.CleanDirectoryRecursively(path);
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) =>
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) =>
|
||||
BaseFileSystem.Target.RenameFile(currentPath, newPath);
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) =>
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) =>
|
||||
BaseFileSystem.Target.RenameDirectory(currentPath, newPath);
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path) =>
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path) =>
|
||||
BaseFileSystem.Target.GetEntryType(out entryType, path);
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path) =>
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path) =>
|
||||
BaseFileSystem.Target.GetFreeSpaceSize(out freeSpace, path);
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path) =>
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path) =>
|
||||
BaseFileSystem.Target.GetTotalSpaceSize(out totalSpace, path);
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode) =>
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode) =>
|
||||
BaseFileSystem.Target.OpenFile(out file, path, mode);
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode) =>
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode) =>
|
||||
BaseFileSystem.Target.OpenDirectory(out directory, path, mode);
|
||||
|
||||
protected override Result DoCommit() => BaseFileSystem.Target.Commit();
|
||||
@ -74,10 +70,10 @@ namespace LibHac.FsSystem
|
||||
|
||||
protected override Result DoFlush() => BaseFileSystem.Target.Flush();
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path) =>
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path) =>
|
||||
BaseFileSystem.Target.GetFileTimeStampRaw(out timeStamp, path);
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path) => BaseFileSystem.Target.QueryEntry(outBuffer, inBuffer, queryId, path);
|
||||
in Path path) => BaseFileSystem.Target.QueryEntry(outBuffer, inBuffer, queryId, path);
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace LibHac.FsSystem
|
||||
Sources.AddRange(sourceFileSystems);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -108,7 +108,7 @@ namespace LibHac.FsSystem
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -137,7 +137,7 @@ namespace LibHac.FsSystem
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -155,7 +155,7 @@ namespace LibHac.FsSystem
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
@ -173,7 +173,7 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path)
|
||||
in Path path)
|
||||
{
|
||||
foreach (IFileSystem fs in Sources)
|
||||
{
|
||||
@ -193,14 +193,14 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoDeleteDirectory(U8Span path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoDeleteFile(U8Span path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoCreateDirectory(in Path path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoDeleteDirectory(in Path path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoDeleteFile(in Path path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) => ResultFs.UnsupportedOperation.Log();
|
||||
|
||||
private class MergedDirectory : IDirectory
|
||||
{
|
||||
|
@ -11,6 +11,7 @@ using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem.Impl;
|
||||
using LibHac.Util;
|
||||
using static LibHac.Fs.StringTraits;
|
||||
using Path = LibHac.Fs.Path;
|
||||
|
||||
namespace LibHac.FsSystem
|
||||
{
|
||||
@ -226,7 +227,7 @@ namespace LibHac.FsSystem
|
||||
return GetSizeInternal(out fileSize, info);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
return DoCreateDirectory(path, NxFileAttributes.None);
|
||||
}
|
||||
@ -252,7 +253,7 @@ namespace LibHac.FsSystem
|
||||
return CreateDirInternal(dir, archiveAttribute);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullPath, path, false);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -280,7 +281,7 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullPath, path, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -292,7 +293,7 @@ namespace LibHac.FsSystem
|
||||
() => DeleteDirectoryInternal(dir, false), _fsClient);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullPath, path, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -304,7 +305,7 @@ namespace LibHac.FsSystem
|
||||
() => DeleteDirectoryInternal(dir, true), _fsClient);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullPath, path, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -340,7 +341,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullPath, path, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -352,7 +353,7 @@ namespace LibHac.FsSystem
|
||||
() => DeleteFileInternal(file), _fsClient);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
Result rc = ResolveFullPath(out string fullPath, path, true);
|
||||
@ -375,7 +376,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -400,7 +401,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result rc = CheckSubPath(currentPath, newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -424,7 +425,7 @@ namespace LibHac.FsSystem
|
||||
() => RenameDirInternal(currentDirInfo, newDirInfo), _fsClient);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullCurrentPath, currentPath, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
@ -445,7 +446,7 @@ namespace LibHac.FsSystem
|
||||
() => RenameFileInternal(currentFileInfo, newFileInfo), _fsClient);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -473,7 +474,7 @@ namespace LibHac.FsSystem
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
@ -503,7 +504,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
@ -514,7 +515,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
@ -531,7 +532,7 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path)
|
||||
in Path path)
|
||||
{
|
||||
return ResultFs.UnsupportedOperation.Log();
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using LibHac.Common;
|
||||
using LibHac.Crypto;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using Path = LibHac.Fs.Path;
|
||||
|
||||
namespace LibHac.FsSystem
|
||||
{
|
||||
@ -33,13 +34,13 @@ namespace LibHac.FsSystem
|
||||
BaseStorage = storage;
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
directory = new PartitionDirectory(this, path.ToString(), mode);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
path = PathTools.Normalize(path.ToString()).TrimStart('/').ToU8Span();
|
||||
|
||||
@ -57,7 +58,7 @@ namespace LibHac.FsSystem
|
||||
return new PartitionFile(BaseStorage, HeaderSize + entry.Offset, entry.Size, mode);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -76,14 +77,14 @@ namespace LibHac.FsSystem
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteFile(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteFile(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
|
||||
protected override Result DoCommit()
|
||||
{
|
||||
|
@ -43,17 +43,13 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
BaseStorageShared?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
BaseStorageShared?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -70,7 +66,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -90,7 +86,7 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -122,14 +118,14 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteFile(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteFile(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCommitProvisionally(long counter) => ResultFs.UnsupportedCommitProvisionallyForPartitionFileSystem.Log();
|
||||
|
||||
private class PartitionFile : IFile
|
||||
|
@ -28,12 +28,12 @@ namespace LibHac.FsSystem
|
||||
return new ReferenceCountedDisposable<IFileSystem>(fs);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
return BaseFs.OpenDirectory(out directory, path, mode);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -44,17 +44,17 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
return BaseFs.GetEntryType(out entryType, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
return BaseFs.GetFreeSpaceSize(out freeSpace, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
return BaseFs.GetTotalSpaceSize(out totalSpace, path);
|
||||
|
||||
@ -62,7 +62,7 @@ namespace LibHac.FsSystem
|
||||
// return ResultFs.UnsupportedOperationReadOnlyFileSystemGetSpace.Log();
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
return BaseFs.GetFileTimeStampRaw(out timeStamp, path);
|
||||
|
||||
@ -75,30 +75,26 @@ namespace LibHac.FsSystem
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoCreateDirectory(in Path path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(in Path path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoDeleteFile(in Path path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
BaseFsShared?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
BaseFsShared?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace LibHac.FsSystem.RomFs
|
||||
FileTable = new HierarchicalRomFileTable<RomFileInfo>(dirHashTable, dirEntryTable, fileHashTable, fileEntryTable);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -49,7 +49,7 @@ namespace LibHac.FsSystem.RomFs
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -62,7 +62,7 @@ namespace LibHac.FsSystem.RomFs
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -86,23 +86,23 @@ namespace LibHac.FsSystem.RomFs
|
||||
return BaseStorage;
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(U8Span path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoDeleteFile(U8Span path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoCreateDirectory(in Path path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(in Path path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoDeleteFile(in Path path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoCommitProvisionally(long counter) => ResultFs.UnsupportedCommitProvisionallyForRomFsFileSystem.Log();
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
freeSpace = 0;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
return ResultFs.UnsupportedGetTotalSpaceSizeForRomFsFileSystem.Log();
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using LibHac.Common;
|
||||
using LibHac.Common.Keys;
|
||||
using LibHac.Crypto;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using Path = LibHac.Fs.Path;
|
||||
|
||||
namespace LibHac.FsSystem.Save
|
||||
{
|
||||
@ -146,91 +146,91 @@ namespace LibHac.FsSystem.Save
|
||||
IntegrityStorageType.Save, integrityCheckLevel, LeaveOpen);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.CreateDirectory(path);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.CreateFile(path, size, option);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.DeleteDirectory(path);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.DeleteDirectoryRecursively(path);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.CleanDirectoryRecursively(path);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.DeleteFile(path);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.OpenDirectory(out directory, path, mode);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.OpenFile(out file, path, mode);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.RenameDirectory(currentPath, newPath);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.RenameFile(currentPath, newPath);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.GetEntryType(out entryType, path);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.GetFreeSpaceSize(out freeSpace, path);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.GetTotalSpaceSize(out totalSpace, path);
|
||||
|
||||
@ -309,15 +309,14 @@ namespace LibHac.FsSystem.Save
|
||||
return journalValidity;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
if (!LeaveOpen)
|
||||
{
|
||||
if (!LeaveOpen)
|
||||
{
|
||||
BaseStorage?.Dispose();
|
||||
}
|
||||
BaseStorage?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using LibHac.Util;
|
||||
using Path = LibHac.Fs.Path;
|
||||
|
||||
namespace LibHac.FsSystem.Save
|
||||
{
|
||||
@ -31,7 +32,7 @@ namespace LibHac.FsSystem.Save
|
||||
FileTable = new HierarchicalSaveFileTable(dirTableStorage, fileTableStorage);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
|
||||
@ -43,7 +44,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
|
||||
@ -73,7 +74,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
|
||||
@ -85,7 +86,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
|
||||
@ -101,7 +102,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
|
||||
@ -113,7 +114,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
|
||||
@ -135,7 +136,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -154,7 +155,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -175,7 +176,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath normalizedNewPath);
|
||||
@ -189,7 +190,7 @@ namespace LibHac.FsSystem.Save
|
||||
return FileTable.RenameDirectory(normalizedCurrentPath, normalizedNewPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath normalizedNewPath);
|
||||
@ -205,7 +206,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -229,7 +230,7 @@ namespace LibHac.FsSystem.Save
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
int freeBlockCount = AllocationTable.GetFreeListLength();
|
||||
freeSpace = Header.BlockSize * freeBlockCount;
|
||||
@ -237,7 +238,7 @@ namespace LibHac.FsSystem.Save
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
totalSpace = Header.BlockSize * Header.BlockCount;
|
||||
|
||||
|
@ -68,12 +68,9 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (_baseFileSystem is null)
|
||||
return;
|
||||
|
||||
if (disposing)
|
||||
if (_baseFileSystem is not null)
|
||||
{
|
||||
if (typeof(T) == typeof(SaveDataFileSystem))
|
||||
{
|
||||
@ -95,60 +92,60 @@ namespace LibHac.FsSystem
|
||||
_baseFileSystem = null;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
return _baseFileSystem.Target.OpenFile(out file, path, mode);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
return _baseFileSystem.Target.OpenDirectory(out directory, path, mode);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.GetEntryType(out entryType, path);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
return _baseFileSystem.Target.CreateFile(path, size, option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.DeleteFile(path);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.CreateDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.DeleteDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.DeleteDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.CleanDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
return _baseFileSystem.Target.RenameFile(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
return _baseFileSystem.Target.RenameDirectory(currentPath, newPath);
|
||||
}
|
||||
@ -168,12 +165,12 @@ namespace LibHac.FsSystem
|
||||
return _baseFileSystem.Target.Rollback();
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.GetFreeSpaceSize(out freeSpace, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
return _baseFileSystem.Target.GetTotalSpaceSize(out totalSpace, path);
|
||||
}
|
||||
|
@ -38,90 +38,86 @@ namespace LibHac.FsSystem
|
||||
new StorageLayoutTypeSetFileSystem(ref baseFileSystem, storageFlag));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
BaseFileSystem?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
BaseFileSystem?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.CreateFile(path, size, option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.DeleteFile(path);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.CreateDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.DeleteDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.DeleteDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.CleanDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.RenameFile(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.RenameDirectory(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.GetEntryType(out entryType, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.GetFreeSpaceSize(out freeSpace, path);
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.GetTotalSpaceSize(out totalSpace, path);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.OpenFile(out file, path, mode);
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.OpenDirectory(out directory, path, mode);
|
||||
@ -151,13 +147,14 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.Target.Flush();
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.GetFileTimeStampRaw(out timeStamp, path);
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId, U8Span path)
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
in Path path)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.QueryEntry(outBuffer, inBuffer, queryId, path);
|
||||
|
@ -44,14 +44,10 @@ namespace LibHac.FsSystem
|
||||
PreserveUnc = preserveUnc;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
public override void Dispose()
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
BaseFileSystemShared?.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
BaseFileSystemShared?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
public Result Initialize(U8Span rootPath)
|
||||
@ -93,7 +89,7 @@ namespace LibHac.FsSystem
|
||||
return PathNormalizer.Normalize(outPath.Slice(RootPath.Length - 2), out _, relativePath, PreserveUnc, false);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path)
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
@ -102,7 +98,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.CreateDirectory(new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
@ -111,7 +107,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.CreateFile(new U8Span(fullPath), size, option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
@ -120,7 +116,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.DeleteDirectory(new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(U8Span path)
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
@ -129,7 +125,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.DeleteDirectoryRecursively(new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(U8Span path)
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
@ -138,7 +134,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.CleanDirectoryRecursively(new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
@ -147,7 +143,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.DeleteFile(new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode)
|
||||
protected override Result DoOpenDirectory(out IDirectory directory, in Path path, OpenDirectoryMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out directory);
|
||||
|
||||
@ -158,7 +154,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.OpenDirectory(out directory, new U8Span(fullPath), mode);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
|
||||
protected override Result DoOpenFile(out IFile file, in Path path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out file);
|
||||
|
||||
@ -169,7 +165,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.OpenFile(out file, new U8Span(fullPath), mode);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Span<byte> fullOldPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Span<byte> fullNewPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
@ -183,7 +179,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.RenameDirectory(new U8Span(fullOldPath), new U8Span(fullNewPath));
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Span<byte> fullOldPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Span<byte> fullNewPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
@ -197,7 +193,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.RenameFile(new U8Span(fullOldPath), new U8Span(fullNewPath));
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
@ -224,7 +220,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.Rollback();
|
||||
}
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
@ -235,7 +231,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.GetFreeSpaceSize(out freeSpace, new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
|
||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
@ -246,7 +242,7 @@ namespace LibHac.FsSystem
|
||||
return BaseFileSystem.GetTotalSpaceSize(out totalSpace, new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
|
||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
@ -258,7 +254,7 @@ namespace LibHac.FsSystem
|
||||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
U8Span path)
|
||||
in Path path)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user