diff --git a/src/LibHac/FsService/FileSystemProxy.cs b/src/LibHac/FsService/FileSystemProxy.cs index 266be3ad..77f1ae68 100644 --- a/src/LibHac/FsService/FileSystemProxy.cs +++ b/src/LibHac/FsService/FileSystemProxy.cs @@ -160,10 +160,10 @@ namespace LibHac.FsService // Check if permissions allow deleting save data } - reader.Indexer.SetState(saveDataId, SaveDataState.Creating); + rc = reader.Indexer.SetState(saveDataId, SaveDataState.Creating); if (rc.IsFailure()) return rc; - reader.Indexer.Commit(); + rc = reader.Indexer.Commit(); if (rc.IsFailure()) return rc; } @@ -406,7 +406,7 @@ namespace LibHac.FsService // Revert changes if an error happened in the middle of creation if (isDeleteNeeded) { - DeleteSaveDataFileSystemImpl2(creationInfo.SpaceId, saveDataId); + DeleteSaveDataFileSystemImpl2(creationInfo.SpaceId, saveDataId).IgnoreResult(); if (reader.IsInitialized && saveDataId != FileSystemServer.SaveIndexerId) { @@ -414,8 +414,8 @@ namespace LibHac.FsService if (rc.IsSuccess() && value.SpaceId == creationInfo.SpaceId) { - reader.Indexer.Delete(saveDataId); - reader.Indexer.Commit(); + reader.Indexer.Delete(saveDataId).IgnoreResult(); + reader.Indexer.Commit().IgnoreResult(); } } } @@ -1151,7 +1151,7 @@ namespace LibHac.FsService rc = FsServer.SaveDataIndexerManager.GetSaveDataIndexer(out reader, SaveDataSpaceId.Temporary); if (rc.IsFailure()) return rc; - reader.Indexer.Reset(); + reader.Indexer.Reset().IgnoreResult(); return Result.Success; } diff --git a/src/LibHac/FsService/FileSystemProxyCore.cs b/src/LibHac/FsService/FileSystemProxyCore.cs index 3531c222..0feb8a81 100644 --- a/src/LibHac/FsService/FileSystemProxyCore.cs +++ b/src/LibHac/FsService/FileSystemProxyCore.cs @@ -677,7 +677,8 @@ namespace LibHac.FsService if (rc.IsFailure()) return rc; - baseFileSystem.EnsureDirectoryExists(contentDirPath.ToString()); + rc = baseFileSystem.EnsureDirectoryExists(contentDirPath.ToString()); + if (rc.IsFailure()) return rc; rc = FsCreators.SubDirectoryFileSystemCreator.Create(out IFileSystem subDirFileSystem, baseFileSystem, contentDirPath); @@ -879,7 +880,7 @@ namespace LibHac.FsService if (cacheExtraData) { - // Missing extra data caching + // todo: Missing extra data caching } fileSystem = openReadOnly ? new ReadOnlyFileSystem(saveFs) : saveFs; diff --git a/src/LibHac/FsService/FileSystemServer.cs b/src/LibHac/FsService/FileSystemServer.cs index ae55b265..84c16f05 100644 --- a/src/LibHac/FsService/FileSystemServer.cs +++ b/src/LibHac/FsService/FileSystemServer.cs @@ -42,7 +42,7 @@ namespace LibHac.FsService SaveDataIndexerManager = new SaveDataIndexerManager(FsClient, SaveIndexerId); - fsProxy.CleanUpTemporaryStorage(); + fsProxy.CleanUpTemporaryStorage().IgnoreResult(); } /// diff --git a/src/LibHac/Result.cs b/src/LibHac/Result.cs index 3a8fd232..660e4be1 100644 --- a/src/LibHac/Result.cs +++ b/src/LibHac/Result.cs @@ -70,6 +70,11 @@ namespace LibHac public bool IsSuccess() => _value == SuccessValue; public bool IsFailure() => !IsSuccess(); + /// + /// Specifies that the from a returned function is explicitly ignored. + /// + public void IgnoreResult() { } + public void ThrowIfFailure() { if (IsFailure()) @@ -212,6 +217,7 @@ namespace LibHac /// new Result.Base(ModuleFs, 2000, 2499). The property will need to have the aggressive inlining flag set like so: /// public static Result.Base SdCardAccessFailed { [MethodImpl(MethodImplOptions.AggressiveInlining)] get => new Result.Base(ModuleFs, 2000, 2499); } /// + [DebuggerDisplay("{" + nameof(ToStringWithName) + "(),nq}")] public struct Base { private const int DescriptionEndBitsOffset = ReservedBitsOffset;