diff --git a/src/LibHac/Fs/Common/Path.cs b/src/LibHac/Fs/Common/Path.cs index e6b20e9b..d5772660 100644 --- a/src/LibHac/Fs/Common/Path.cs +++ b/src/LibHac/Fs/Common/Path.cs @@ -6,7 +6,8 @@ using LibHac.Diag; using LibHac.Util; using static LibHac.Fs.StringTraits; -namespace LibHac.Fs.Common +// ReSharper disable once CheckNamespace +namespace LibHac.Fs { public struct PathFlags { diff --git a/src/LibHac/Fs/Common/PathFormatter.cs b/src/LibHac/Fs/Common/PathFormatter.cs index 8f4975d7..4079c15c 100644 --- a/src/LibHac/Fs/Common/PathFormatter.cs +++ b/src/LibHac/Fs/Common/PathFormatter.cs @@ -8,7 +8,8 @@ using LibHac.FsSystem; using LibHac.Util; using static LibHac.Fs.StringTraits; -namespace LibHac.Fs.Common +// ReSharper disable once CheckNamespace +namespace LibHac.Fs { public static class PathFormatter { diff --git a/src/LibHac/Fs/Common/PathNormalizer12.cs b/src/LibHac/Fs/Common/PathNormalizer12.cs index b822484d..298f2c27 100644 --- a/src/LibHac/Fs/Common/PathNormalizer12.cs +++ b/src/LibHac/Fs/Common/PathNormalizer12.cs @@ -2,10 +2,11 @@ using LibHac.Common; using LibHac.Diag; using LibHac.FsSystem; -using static LibHac.Fs.Common.PathUtility12; +using static LibHac.Fs.PathUtility12; using static LibHac.Fs.StringTraits; -namespace LibHac.Fs.Common +// ReSharper disable once CheckNamespace +namespace LibHac.Fs { public static class PathNormalizer12 { diff --git a/src/LibHac/Fs/Common/PathUtility12.cs b/src/LibHac/Fs/Common/PathUtility12.cs index 9edc8828..ebc41f87 100644 --- a/src/LibHac/Fs/Common/PathUtility12.cs +++ b/src/LibHac/Fs/Common/PathUtility12.cs @@ -1,12 +1,12 @@ using System; -using System.Runtime.CompilerServices; using LibHac.Common; using LibHac.Diag; using LibHac.FsSrv.Sf; using LibHac.Util; using static LibHac.Fs.StringTraits; -namespace LibHac.Fs.Common +// ReSharper disable once CheckNamespace +namespace LibHac.Fs { public static class PathUtility12 { diff --git a/src/LibHac/Fs/Common/WindowsPath12.cs b/src/LibHac/Fs/Common/WindowsPath12.cs index 07de8fc4..02ce5bb6 100644 --- a/src/LibHac/Fs/Common/WindowsPath12.cs +++ b/src/LibHac/Fs/Common/WindowsPath12.cs @@ -4,7 +4,8 @@ using LibHac.Diag; using LibHac.Util; using static LibHac.Util.CharacterEncoding; -namespace LibHac.Fs.Common +// ReSharper disable once CheckNamespace +namespace LibHac.Fs { public static class WindowsPath12 { diff --git a/src/LibHac/Fs/Impl/FileSystemServiceObjectAdapter.cs b/src/LibHac/Fs/Impl/FileSystemServiceObjectAdapter.cs index 15627179..6901fe51 100644 --- a/src/LibHac/Fs/Impl/FileSystemServiceObjectAdapter.cs +++ b/src/LibHac/Fs/Impl/FileSystemServiceObjectAdapter.cs @@ -2,11 +2,11 @@ using System.Runtime.CompilerServices; using LibHac.Common; using LibHac.Fs.Fsa; -using LibHac.FsSrv.Sf; using LibHac.Util; using IFileSystemSf = LibHac.FsSrv.Sf.IFileSystem; using IFileSf = LibHac.FsSrv.Sf.IFile; using IDirectorySf = LibHac.FsSrv.Sf.IDirectory; +using PathSf = LibHac.FsSrv.Sf.Path; namespace LibHac.Fs.Impl { @@ -14,7 +14,7 @@ namespace LibHac.Fs.Impl /// An adapter for using an service object as an . Used /// when receiving a Horizon IPC file system object so it can be used as an locally. /// - internal class FileSystemServiceObjectAdapter : Fsa.IFileSystem, IMultiCommitTarget + internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget { private ReferenceCountedDisposable BaseFs { get; } @@ -25,7 +25,7 @@ namespace LibHac.Fs.Impl protected override Result DoCreateFile(U8Span path, long size, CreateFileOptions option) { - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.CreateFile(in sfPath, size, (int)option); @@ -33,7 +33,7 @@ namespace LibHac.Fs.Impl protected override Result DoDeleteFile(U8Span path) { - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.DeleteFile(in sfPath); @@ -41,7 +41,7 @@ namespace LibHac.Fs.Impl protected override Result DoCreateDirectory(U8Span path) { - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.DeleteFile(in sfPath); @@ -49,7 +49,7 @@ namespace LibHac.Fs.Impl protected override Result DoDeleteDirectory(U8Span path) { - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.DeleteDirectory(in sfPath); @@ -57,7 +57,7 @@ namespace LibHac.Fs.Impl protected override Result DoDeleteDirectoryRecursively(U8Span path) { - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.DeleteDirectoryRecursively(in sfPath); @@ -65,7 +65,7 @@ namespace LibHac.Fs.Impl protected override Result DoCleanDirectoryRecursively(U8Span path) { - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.CleanDirectoryRecursively(in sfPath); @@ -73,10 +73,10 @@ namespace LibHac.Fs.Impl protected override Result DoRenameFile(U8Span oldPath, U8Span newPath) { - Result rc = GetPathForServiceObject(out Path oldSfPath, oldPath); + Result rc = GetPathForServiceObject(out PathSf oldSfPath, oldPath); if (rc.IsFailure()) return rc; - rc = GetPathForServiceObject(out Path newSfPath, newPath); + rc = GetPathForServiceObject(out PathSf newSfPath, newPath); if (rc.IsFailure()) return rc; return BaseFs.Target.RenameFile(in oldSfPath, in newSfPath); @@ -84,10 +84,10 @@ namespace LibHac.Fs.Impl protected override Result DoRenameDirectory(U8Span oldPath, U8Span newPath) { - Result rc = GetPathForServiceObject(out Path oldSfPath, oldPath); + Result rc = GetPathForServiceObject(out PathSf oldSfPath, oldPath); if (rc.IsFailure()) return rc; - rc = GetPathForServiceObject(out Path newSfPath, newPath); + rc = GetPathForServiceObject(out PathSf newSfPath, newPath); if (rc.IsFailure()) return rc; return BaseFs.Target.RenameDirectory(in oldSfPath, in newSfPath); @@ -97,7 +97,7 @@ namespace LibHac.Fs.Impl { UnsafeHelpers.SkipParamInit(out entryType); - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; ref uint sfEntryType = ref Unsafe.As(ref entryType); @@ -109,7 +109,7 @@ namespace LibHac.Fs.Impl { UnsafeHelpers.SkipParamInit(out freeSpace); - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.GetFreeSpaceSize(out freeSpace, in sfPath); @@ -119,17 +119,17 @@ namespace LibHac.Fs.Impl { UnsafeHelpers.SkipParamInit(out totalSpace); - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.GetTotalSpaceSize(out totalSpace, in sfPath); } - protected override Result DoOpenFile(out Fsa.IFile file, U8Span path, OpenMode mode) + protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode) { UnsafeHelpers.SkipParamInit(out file); - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; ReferenceCountedDisposable sfFile = null; @@ -147,11 +147,11 @@ namespace LibHac.Fs.Impl } } - protected override Result DoOpenDirectory(out Fsa.IDirectory directory, U8Span path, OpenDirectoryMode mode) + protected override Result DoOpenDirectory(out IDirectory directory, U8Span path, OpenDirectoryMode mode) { UnsafeHelpers.SkipParamInit(out directory); - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; ReferenceCountedDisposable sfDir = null; @@ -178,7 +178,7 @@ namespace LibHac.Fs.Impl { UnsafeHelpers.SkipParamInit(out timeStamp); - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.GetFileTimeStampRaw(out timeStamp, in sfPath); @@ -187,7 +187,7 @@ namespace LibHac.Fs.Impl protected override Result DoQueryEntry(Span outBuffer, ReadOnlySpan inBuffer, QueryId queryId, U8Span path) { - Result rc = GetPathForServiceObject(out Path sfPath, path); + Result rc = GetPathForServiceObject(out PathSf sfPath, path); if (rc.IsFailure()) return rc; return BaseFs.Target.QueryEntry(outBuffer, inBuffer, (int)queryId, in sfPath); @@ -208,7 +208,7 @@ namespace LibHac.Fs.Impl base.Dispose(disposing); } - private Result GetPathForServiceObject(out Path sfPath, U8Span path) + private Result GetPathForServiceObject(out PathSf sfPath, U8Span path) { // This is the function used to create Sf.Path structs. Get an unsafe byte span for init only. UnsafeHelpers.SkipParamInit(out sfPath); @@ -216,7 +216,7 @@ namespace LibHac.Fs.Impl // Copy and null terminate StringUtils.Copy(outPath, path); - outPath[Unsafe.SizeOf() - 1] = StringTraits.NullTerminator; + outPath[Unsafe.SizeOf() - 1] = StringTraits.NullTerminator; // Replace directory separators PathUtility.Replace(outPath, StringTraits.AltDirectorySeparator, StringTraits.DirectorySeparator); diff --git a/src/LibHac/FsSrv/Impl/FileSystemInterfaceAdapter.cs b/src/LibHac/FsSrv/Impl/FileSystemInterfaceAdapter.cs index 357c3434..5cbc915d 100644 --- a/src/LibHac/FsSrv/Impl/FileSystemInterfaceAdapter.cs +++ b/src/LibHac/FsSrv/Impl/FileSystemInterfaceAdapter.cs @@ -3,12 +3,12 @@ using System.Runtime.CompilerServices; using LibHac.Common; using LibHac.Fs; using LibHac.Fs.Fsa; -using LibHac.FsSrv.Sf; using LibHac.Util; using IFileSystem = LibHac.Fs.Fsa.IFileSystem; using IFileSystemSf = LibHac.FsSrv.Sf.IFileSystem; using IFileSf = LibHac.FsSrv.Sf.IFile; using IDirectorySf = LibHac.FsSrv.Sf.IDirectory; +using Path = LibHac.FsSrv.Sf.Path; namespace LibHac.FsSrv.Impl { @@ -182,7 +182,7 @@ namespace LibHac.FsSrv.Impl if (normalizer.Result.IsFailure()) return normalizer.Result; Result rc = Result.Success; - Fs.Fsa.IFile fileInterface = null; + IFile fileInterface = null; for (int tryNum = 0; tryNum < maxTryCount; tryNum++) { @@ -211,7 +211,7 @@ namespace LibHac.FsSrv.Impl if (normalizer.Result.IsFailure()) return normalizer.Result; Result rc = Result.Success; - Fs.Fsa.IDirectory dirInterface = null; + IDirectory dirInterface = null; for (int tryNum = 0; tryNum < maxTryCount; tryNum++) { diff --git a/src/LibHac/FsSrv/Impl/LocationResolverSet.cs b/src/LibHac/FsSrv/Impl/LocationResolverSet.cs index e152dd2b..2c81d309 100644 --- a/src/LibHac/FsSrv/Impl/LocationResolverSet.cs +++ b/src/LibHac/FsSrv/Impl/LocationResolverSet.cs @@ -5,6 +5,7 @@ using LibHac.Fs; using LibHac.Lr; using LibHac.Ncm; using LibHac.Os; +using Path = LibHac.Lr.Path; namespace LibHac.FsSrv.Impl { diff --git a/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs b/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs index 2f9057e8..57c61849 100644 --- a/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs +++ b/src/LibHac/FsSrv/NcaFileSystemServiceImpl.cs @@ -8,13 +8,13 @@ using LibHac.FsSrv.FsCreator; using LibHac.FsSrv.Impl; using LibHac.FsSystem; using LibHac.FsSystem.NcaUtils; -using LibHac.Lr; using LibHac.Ncm; using LibHac.Os; using LibHac.Spl; using LibHac.Util; using RightsId = LibHac.Fs.RightsId; using Utility = LibHac.FsSrv.Impl.Utility; +using PathLr = LibHac.Lr.Path; namespace LibHac.FsSrv { @@ -828,7 +828,7 @@ namespace LibHac.FsSrv return Result.Success; } - public Result ResolveProgramPath(out Path path, ProgramId programId, StorageId storageId) + public Result ResolveProgramPath(out PathLr path, ProgramId programId, StorageId storageId) { Result rc = _locationResolverSet.ResolveProgramPath(out path, programId.Value, storageId); if (rc.IsSuccess()) @@ -843,18 +843,18 @@ namespace LibHac.FsSrv return ResultFs.TargetNotFound.Log(); } - public Result ResolveRomPath(out Path path, ulong id, StorageId storageId) + public Result ResolveRomPath(out PathLr path, ulong id, StorageId storageId) { return _locationResolverSet.ResolveRomPath(out path, id, storageId); } - public Result ResolveApplicationHtmlDocumentPath(out Path path, Ncm.ApplicationId applicationId, + public Result ResolveApplicationHtmlDocumentPath(out PathLr path, Ncm.ApplicationId applicationId, StorageId storageId) { return _locationResolverSet.ResolveApplicationHtmlDocumentPath(out path, applicationId, storageId); } - public Result ResolveRegisteredHtmlDocumentPath(out Path path, ulong id) + public Result ResolveRegisteredHtmlDocumentPath(out PathLr path, ulong id) { return _locationResolverSet.ResolveRegisteredHtmlDocumentPath(out path, id); } diff --git a/src/LibHac/FsSystem/LocalFileSystem.cs b/src/LibHac/FsSystem/LocalFileSystem.cs index 726ff612..5a4686a8 100644 --- a/src/LibHac/FsSystem/LocalFileSystem.cs +++ b/src/LibHac/FsSystem/LocalFileSystem.cs @@ -56,7 +56,7 @@ namespace LibHac.FsSystem /// The path that will be the root of the . public LocalFileSystem(string rootPath) { - _rootPath = Path.GetFullPath(rootPath); + _rootPath = System.IO.Path.GetFullPath(rootPath); if (!Directory.Exists(_rootPath)) { @@ -98,7 +98,7 @@ namespace LibHac.FsSystem try { - _rootPath = Path.GetFullPath(rootPath); + _rootPath = System.IO.Path.GetFullPath(rootPath); } catch (PathTooLongException) { diff --git a/src/LibHac/SwitchFs.cs b/src/LibHac/SwitchFs.cs index 26f3a459..520f524c 100644 --- a/src/LibHac/SwitchFs.cs +++ b/src/LibHac/SwitchFs.cs @@ -126,7 +126,7 @@ namespace LibHac foreach (DirectoryEntryEx fileEntry in SaveFs.EnumerateEntries().Where(x => x.Type == DirectoryEntryType.File)) { SaveDataFileSystem save = null; - string saveName = Path.GetFileNameWithoutExtension(fileEntry.Name); + string saveName = System.IO.Path.GetFileNameWithoutExtension(fileEntry.Name); try { @@ -251,7 +251,7 @@ namespace LibHac { if (nca.Nca.Header.ContentType != NcaContentType.Meta || !name.EndsWith(".cnmt.nca")) { - return Path.GetFileNameWithoutExtension(name); + return System.IO.Path.GetFileNameWithoutExtension(name); } return name.Substring(0, name.Length - ".cnmt.nca".Length); diff --git a/src/hactoolnet/ProcessKip.cs b/src/hactoolnet/ProcessKip.cs index 901bc27d..3cc9aa5b 100644 --- a/src/hactoolnet/ProcessKip.cs +++ b/src/hactoolnet/ProcessKip.cs @@ -52,7 +52,7 @@ namespace hactoolnet kipReader.Initialize(kipStorage).ThrowIfFailure(); - kipStorage.WriteAllBytes(Path.Combine(outDir, $"{kipReader.Name.ToString()}.kip1")); + kipStorage.WriteAllBytes(System.IO.Path.Combine(outDir, $"{kipReader.Name.ToString()}.kip1")); } } } diff --git a/src/hactoolnet/ProcessPackage.cs b/src/hactoolnet/ProcessPackage.cs index 5e54b286..a820a9ad 100644 --- a/src/hactoolnet/ProcessPackage.cs +++ b/src/hactoolnet/ProcessPackage.cs @@ -7,6 +7,7 @@ using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; using static hactoolnet.Print; +using Path = System.IO.Path; namespace hactoolnet { diff --git a/src/hactoolnet/ProcessSave.cs b/src/hactoolnet/ProcessSave.cs index 20bd8355..bedca09c 100644 --- a/src/hactoolnet/ProcessSave.cs +++ b/src/hactoolnet/ProcessSave.cs @@ -12,6 +12,7 @@ using LibHac.Fs.Impl; using LibHac.FsSystem; using LibHac.FsSystem.Save; using static hactoolnet.Print; +using Path = System.IO.Path; namespace hactoolnet { diff --git a/src/hactoolnet/ProcessSwitchFs.cs b/src/hactoolnet/ProcessSwitchFs.cs index fbe9c50b..d6c8f988 100644 --- a/src/hactoolnet/ProcessSwitchFs.cs +++ b/src/hactoolnet/ProcessSwitchFs.cs @@ -11,6 +11,7 @@ using LibHac.FsSystem; using LibHac.FsSystem.NcaUtils; using LibHac.FsSystem.Save; using LibHac.Ns; +using Path = System.IO.Path; namespace hactoolnet { diff --git a/src/hactoolnet/ProcessXci.cs b/src/hactoolnet/ProcessXci.cs index 8b1c7807..ac333423 100644 --- a/src/hactoolnet/ProcessXci.cs +++ b/src/hactoolnet/ProcessXci.cs @@ -56,7 +56,7 @@ namespace hactoolnet foreach (PartitionFileEntry sub in root.Files) { var subPfs = new PartitionFileSystem(root.OpenFile(sub, OpenMode.Read).AsStorage()); - string subDir = Path.Combine(ctx.Options.OutDir, sub.Name); + string subDir = System.IO.Path.Combine(ctx.Options.OutDir, sub.Name); subPfs.Extract(subDir, ctx.Logger); } diff --git a/src/hactoolnet/Program.cs b/src/hactoolnet/Program.cs index 54c3d765..ac8b0c86 100644 --- a/src/hactoolnet/Program.cs +++ b/src/hactoolnet/Program.cs @@ -6,6 +6,7 @@ using LibHac.Common.Keys; using LibHac.Diag; using LibHac.Fs; using LibHac.Util; +using Path = System.IO.Path; namespace hactoolnet { diff --git a/tests/LibHac.Tests/Fs/PathFormatterTests.cs b/tests/LibHac.Tests/Fs/PathFormatterTests.cs index 16842a8b..c7d19ad3 100644 --- a/tests/LibHac.Tests/Fs/PathFormatterTests.cs +++ b/tests/LibHac.Tests/Fs/PathFormatterTests.cs @@ -3,7 +3,6 @@ using System; using LibHac.Common; using LibHac.Fs; -using LibHac.Fs.Common; using LibHac.Util; using Xunit; diff --git a/tests/LibHac.Tests/Fs/PathNormalizerTests.cs b/tests/LibHac.Tests/Fs/PathNormalizerTests.cs index 0244d039..4b1c8d2e 100644 --- a/tests/LibHac.Tests/Fs/PathNormalizerTests.cs +++ b/tests/LibHac.Tests/Fs/PathNormalizerTests.cs @@ -2,7 +2,6 @@ using LibHac.Common; using LibHac.Fs; -using LibHac.Fs.Common; using LibHac.Util; using Xunit; diff --git a/tests/LibHac.Tests/Fs/PathUtilityTests.cs b/tests/LibHac.Tests/Fs/PathUtilityTests.cs index 2c349a73..063172af 100644 --- a/tests/LibHac.Tests/Fs/PathUtilityTests.cs +++ b/tests/LibHac.Tests/Fs/PathUtilityTests.cs @@ -1,5 +1,7 @@ -using LibHac.Common; -using LibHac.Fs.Common; +// ReSharper disable InconsistentNaming + +using LibHac.Common; +using LibHac.Fs; using Xunit; namespace LibHac.Tests.Fs