mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Rename IFilesystem params
This commit is contained in:
parent
ba0c7405fa
commit
b7897c8553
20 changed files with 104 additions and 104 deletions
|
@ -157,52 +157,52 @@ namespace LibHac.Fs.Fsa
|
|||
/// <summary>
|
||||
/// Renames or moves a file to a new location.
|
||||
/// </summary>
|
||||
/// <param name="oldPath">The full path of the file to rename.</param>
|
||||
/// <param name="currentPath">The 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>
|
||||
/// <remarks>
|
||||
/// If <paramref name="oldPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns successfully.
|
||||
/// 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="oldPath"/> does not exist or is a directory: <see cref="ResultFs.PathNotFound"/>
|
||||
/// <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 oldPath, U8Span newPath)
|
||||
public Result RenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
if (oldPath.IsNull())
|
||||
if (currentPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
if (newPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoRenameFile(oldPath, newPath);
|
||||
return DoRenameFile(currentPath, newPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renames or moves a directory to a new location.
|
||||
/// </summary>
|
||||
/// <param name="oldPath">The full path of the directory to rename.</param>
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// If <paramref name="oldPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns <see cref="Result.Success"/>.
|
||||
/// 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="oldPath"/> does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
|
||||
/// <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="oldPath"/> or <paramref name="newPath"/> is a subpath of the other: <see cref="ResultFs.DirectoryNotRenamable"/>
|
||||
/// Either <paramref name="currentPath"/> or <paramref name="newPath"/> is a subpath of the other: <see cref="ResultFs.DirectoryNotRenamable"/>
|
||||
/// </remarks>
|
||||
public Result RenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
public Result RenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
if (oldPath.IsNull())
|
||||
if (currentPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
if (newPath.IsNull())
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
return DoRenameDirectory(oldPath, newPath);
|
||||
return DoRenameDirectory(currentPath, newPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -387,8 +387,8 @@ namespace LibHac.Fs.Fsa
|
|||
protected abstract Result DoDeleteDirectory(U8Span path);
|
||||
protected abstract Result DoDeleteDirectoryRecursively(U8Span path);
|
||||
protected abstract Result DoCleanDirectoryRecursively(U8Span path);
|
||||
protected abstract Result DoRenameFile(U8Span oldPath, U8Span newPath);
|
||||
protected abstract Result DoRenameDirectory(U8Span oldPath, U8Span newPath);
|
||||
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 virtual Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
|
|
|
@ -71,9 +71,9 @@ namespace LibHac.Fs.Impl
|
|||
return BaseFs.Target.CleanDirectoryRecursively(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf oldSfPath, oldPath);
|
||||
Result rc = GetPathForServiceObject(out PathSf oldSfPath, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = GetPathForServiceObject(out PathSf newSfPath, newPath);
|
||||
|
@ -82,9 +82,9 @@ namespace LibHac.Fs.Impl
|
|||
return BaseFs.Target.RenameFile(in oldSfPath, in newSfPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf oldSfPath, oldPath);
|
||||
Result rc = GetPathForServiceObject(out PathSf oldSfPath, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = GetPathForServiceObject(out PathSf newSfPath, newPath);
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace LibHac.Fs
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
Result rc = PathNormalizer.Normalize(normalizedPath.Str, out _, path, false, false);
|
||||
|
|
|
@ -145,14 +145,14 @@ namespace LibHac.FsSrv.Impl
|
|||
return ConvertResult(BaseFileSystem.Target.CleanDirectoryRecursively(path));
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.RenameFile(oldPath, newPath));
|
||||
return ConvertResult(BaseFileSystem.Target.RenameFile(currentPath, newPath));
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
return ConvertResult(BaseFileSystem.Target.RenameDirectory(oldPath, newPath));
|
||||
return ConvertResult(BaseFileSystem.Target.RenameDirectory(currentPath, newPath));
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
|
|
|
@ -48,9 +48,9 @@ namespace LibHac.FsSystem
|
|||
return BaseFileSystem.CreateDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
return CreateFile(path, size, options, new byte[0x20]);
|
||||
return CreateFile(path, size, option, new byte[0x20]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -126,7 +126,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
// todo: Return proper result codes
|
||||
|
||||
|
@ -138,17 +138,17 @@ namespace LibHac.FsSystem
|
|||
// Reencrypt any modified file headers with the old path
|
||||
// Rename directory to the old path
|
||||
|
||||
Result rc = BaseFileSystem.RenameDirectory(oldPath, newPath);
|
||||
Result rc = BaseFileSystem.RenameDirectory(currentPath, newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
try
|
||||
{
|
||||
RenameDirectoryImpl(oldPath.ToString(), newPath.ToString(), false);
|
||||
RenameDirectoryImpl(currentPath.ToString(), newPath.ToString(), false);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
RenameDirectoryImpl(oldPath.ToString(), newPath.ToString(), true);
|
||||
BaseFileSystem.RenameDirectory(oldPath, newPath);
|
||||
RenameDirectoryImpl(currentPath.ToString(), newPath.ToString(), true);
|
||||
BaseFileSystem.RenameDirectory(currentPath, newPath);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
@ -186,13 +186,13 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
// todo: Return proper result codes
|
||||
|
||||
AesXtsFileHeader header = ReadXtsHeader(oldPath.ToString(), oldPath.ToString());
|
||||
AesXtsFileHeader header = ReadXtsHeader(currentPath.ToString(), currentPath.ToString());
|
||||
|
||||
Result rc = BaseFileSystem.RenameFile(oldPath, newPath);
|
||||
Result rc = BaseFileSystem.RenameFile(currentPath, newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
try
|
||||
|
@ -201,8 +201,8 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
BaseFileSystem.RenameFile(newPath, oldPath);
|
||||
WriteXtsHeader(header, oldPath.ToString(), oldPath.ToString());
|
||||
BaseFileSystem.RenameFile(newPath, currentPath);
|
||||
WriteXtsHeader(header, currentPath.ToString(), currentPath.ToString());
|
||||
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -37,12 +37,12 @@ namespace LibHac.FsSystem
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -112,11 +112,11 @@ namespace LibHac.FsSystem
|
|||
return BaseFileSystem.CreateDirectory(path);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
CreateFileOptions newOptions = options & ~CreateFileOptions.CreateConcatenationFile;
|
||||
CreateFileOptions newOptions = option & ~CreateFileOptions.CreateConcatenationFile;
|
||||
|
||||
if (!options.HasFlag(CreateFileOptions.CreateConcatenationFile))
|
||||
if (!option.HasFlag(CreateFileOptions.CreateConcatenationFile))
|
||||
{
|
||||
return BaseFileSystem.CreateFile(path, size, newOptions);
|
||||
}
|
||||
|
@ -253,25 +253,25 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
if (IsConcatenationFile(oldPath))
|
||||
if (IsConcatenationFile(currentPath))
|
||||
{
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
return BaseFileSystem.RenameDirectory(oldPath, newPath);
|
||||
return BaseFileSystem.RenameDirectory(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
if (IsConcatenationFile(oldPath))
|
||||
if (IsConcatenationFile(currentPath))
|
||||
{
|
||||
return BaseFileSystem.RenameDirectory(oldPath, newPath);
|
||||
return BaseFileSystem.RenameDirectory(currentPath, newPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
return BaseFileSystem.RenameFile(oldPath, newPath);
|
||||
return BaseFileSystem.RenameFile(currentPath, newPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullPath);
|
||||
|
||||
|
@ -308,7 +308,7 @@ namespace LibHac.FsSystem
|
|||
|
||||
using ScopedLock<SdkMutexType> lk = ScopedLock.Lock(ref _mutex);
|
||||
|
||||
return _baseFs.CreateFile(fullPath, size, options);
|
||||
return _baseFs.CreateFile(fullPath, size, option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(U8Span path)
|
||||
|
@ -371,12 +371,12 @@ namespace LibHac.FsSystem
|
|||
return _baseFs.CleanDirectoryRecursively(fullPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath fullNewPath);
|
||||
|
||||
Result rc = ResolveFullPath(fullCurrentPath.Str, oldPath);
|
||||
Result rc = ResolveFullPath(fullCurrentPath.Str, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = ResolveFullPath(fullNewPath.Str, newPath);
|
||||
|
@ -387,12 +387,12 @@ namespace LibHac.FsSystem
|
|||
return _baseFs.RenameFile(fullCurrentPath, fullNewPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath fullCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath fullNewPath);
|
||||
|
||||
Result rc = ResolveFullPath(fullCurrentPath.Str, oldPath);
|
||||
Result rc = ResolveFullPath(fullCurrentPath.Str, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = ResolveFullPath(fullNewPath.Str, newPath);
|
||||
|
|
|
@ -44,11 +44,11 @@ namespace LibHac.FsSystem
|
|||
protected override Result DoCleanDirectoryRecursively(U8Span path) =>
|
||||
BaseFileSystem.Target.CleanDirectoryRecursively(path);
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath) =>
|
||||
BaseFileSystem.Target.RenameFile(oldPath, newPath);
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) =>
|
||||
BaseFileSystem.Target.RenameFile(currentPath, newPath);
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath) =>
|
||||
BaseFileSystem.Target.RenameDirectory(oldPath, newPath);
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) =>
|
||||
BaseFileSystem.Target.RenameDirectory(currentPath, newPath);
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path) =>
|
||||
BaseFileSystem.Target.GetEntryType(out entryType, path);
|
||||
|
|
|
@ -194,13 +194,13 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options) => 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 oldPath, U8Span newPath) => ResultFs.UnsupportedOperation.Log();
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath) => 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();
|
||||
|
||||
private class MergedDirectory : IDirectory
|
||||
{
|
||||
|
|
|
@ -252,7 +252,7 @@ namespace LibHac.FsSystem
|
|||
return CreateDirInternal(dir, archiveAttribute);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullPath, path, false);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
@ -400,12 +400,12 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result rc = CheckSubPath(oldPath, newPath);
|
||||
Result rc = CheckSubPath(currentPath, newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = ResolveFullPath(out string fullCurrentPath, oldPath, true);
|
||||
rc = ResolveFullPath(out string fullCurrentPath, currentPath, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = ResolveFullPath(out string fullNewPath, newPath, false);
|
||||
|
@ -424,9 +424,9 @@ namespace LibHac.FsSystem
|
|||
() => RenameDirInternal(currentDirInfo, newDirInfo), _fsClient);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result rc = ResolveFullPath(out string fullCurrentPath, oldPath, true);
|
||||
Result rc = ResolveFullPath(out string fullCurrentPath, currentPath, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = ResolveFullPath(out string fullNewPath, newPath, false);
|
||||
|
|
|
@ -77,13 +77,13 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options) => 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 oldPath, U8Span newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath) => 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 DoCommit()
|
||||
{
|
||||
|
|
|
@ -123,13 +123,13 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options) => 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 oldPath, U8Span newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath) => 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 DoCommitProvisionally(long counter) => ResultFs.UnsupportedCommitProvisionallyForPartitionFileSystem.Log();
|
||||
|
||||
private class PartitionFile : IFile
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace LibHac.FsSystem
|
|||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
|
@ -87,9 +87,9 @@ namespace LibHac.FsSystem
|
|||
|
||||
protected override Result DoDeleteFile(U8Span path) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath) => ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
|
|
|
@ -87,13 +87,13 @@ namespace LibHac.FsSystem.RomFs
|
|||
}
|
||||
|
||||
protected override Result DoCreateDirectory(U8Span path) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options) => 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 oldPath, U8Span newPath) => ResultFs.UnsupportedWriteForRomFsFileSystem.Log();
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath) => 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 DoCommitProvisionally(long counter) => ResultFs.UnsupportedCommitProvisionallyForRomFsFileSystem.Log();
|
||||
|
||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
|
||||
|
|
|
@ -153,9 +153,9 @@ namespace LibHac.FsSystem.Save
|
|||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.CreateFile(path, size, options);
|
||||
Result result = SaveDataFileSystemCore.CreateFile(path, size, option);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
@ -202,16 +202,16 @@ namespace LibHac.FsSystem.Save
|
|||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.RenameDirectory(oldPath, newPath);
|
||||
Result result = SaveDataFileSystemCore.RenameDirectory(currentPath, newPath);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result result = SaveDataFileSystemCore.RenameFile(oldPath, newPath);
|
||||
Result result = SaveDataFileSystemCore.RenameFile(currentPath, newPath);
|
||||
|
||||
return SaveResults.ConvertToExternalResult(result).LogConverted(result);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace LibHac.FsSystem.Save
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedPath);
|
||||
|
||||
|
@ -175,12 +175,12 @@ namespace LibHac.FsSystem.Save
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath normalizedNewPath);
|
||||
|
||||
Result rc = PathNormalizer.Normalize(normalizedCurrentPath.Str, out _, oldPath, false, false);
|
||||
Result rc = PathNormalizer.Normalize(normalizedCurrentPath.Str, out _, currentPath, false, false);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = PathNormalizer.Normalize(normalizedNewPath.Str, out _, newPath, false, false);
|
||||
|
@ -189,12 +189,12 @@ namespace LibHac.FsSystem.Save
|
|||
return FileTable.RenameDirectory(normalizedCurrentPath, normalizedNewPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Unsafe.SkipInit(out FsPath normalizedCurrentPath);
|
||||
Unsafe.SkipInit(out FsPath normalizedNewPath);
|
||||
|
||||
Result rc = PathNormalizer.Normalize(normalizedCurrentPath.Str, out _, oldPath, false, false);
|
||||
Result rc = PathNormalizer.Normalize(normalizedCurrentPath.Str, out _, currentPath, false, false);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = PathNormalizer.Normalize(normalizedNewPath.Str, out _, newPath, false, false);
|
||||
|
|
|
@ -143,14 +143,14 @@ namespace LibHac.FsSystem
|
|||
return _baseFileSystem.Target.CleanDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
return _baseFileSystem.Target.RenameFile(oldPath, newPath);
|
||||
return _baseFileSystem.Target.RenameFile(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
return _baseFileSystem.Target.RenameDirectory(oldPath, newPath);
|
||||
return _baseFileSystem.Target.RenameDirectory(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoCommit()
|
||||
|
|
|
@ -85,16 +85,16 @@ namespace LibHac.FsSystem
|
|||
return BaseFileSystem.Target.CleanDirectoryRecursively(path);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.RenameFile(oldPath, newPath);
|
||||
return BaseFileSystem.Target.RenameFile(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(StorageFlag);
|
||||
return BaseFileSystem.Target.RenameDirectory(oldPath, newPath);
|
||||
return BaseFileSystem.Target.RenameDirectory(currentPath, newPath);
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path)
|
||||
|
|
|
@ -102,13 +102,13 @@ namespace LibHac.FsSystem
|
|||
return BaseFileSystem.CreateDirectory(new U8Span(fullPath));
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions options)
|
||||
protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
Span<byte> fullPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Result rc = ResolveFullPath(fullPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
return BaseFileSystem.CreateFile(new U8Span(fullPath), size, options);
|
||||
return BaseFileSystem.CreateFile(new U8Span(fullPath), size, option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(U8Span path)
|
||||
|
@ -169,12 +169,12 @@ namespace LibHac.FsSystem
|
|||
return BaseFileSystem.OpenFile(out file, new U8Span(fullPath), mode);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Span<byte> fullOldPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Span<byte> fullNewPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
|
||||
Result rc = ResolveFullPath(fullOldPath, oldPath);
|
||||
Result rc = ResolveFullPath(fullOldPath, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = ResolveFullPath(fullNewPath, newPath);
|
||||
|
@ -183,12 +183,12 @@ namespace LibHac.FsSystem
|
|||
return BaseFileSystem.RenameDirectory(new U8Span(fullOldPath), new U8Span(fullNewPath));
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(U8Span oldPath, U8Span newPath)
|
||||
protected override Result DoRenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Span<byte> fullOldPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
Span<byte> fullNewPath = stackalloc byte[PathTools.MaxPathLength + 1];
|
||||
|
||||
Result rc = ResolveFullPath(fullOldPath, oldPath);
|
||||
Result rc = ResolveFullPath(fullOldPath, currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
rc = ResolveFullPath(fullNewPath, newPath);
|
||||
|
|
Loading…
Reference in a new issue