From 5c1a7920d2ba605102eaee6553c71e193e425f8f Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sun, 12 Jan 2020 14:59:51 -0700 Subject: [PATCH] Open temp directory savedata properly --- src/LibHac/FsService/Creators/SaveDataFileSystemCreator.cs | 4 +++- src/LibHac/FsSystem/DirectorySaveDataFileSystem.cs | 7 ++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/LibHac/FsService/Creators/SaveDataFileSystemCreator.cs b/src/LibHac/FsService/Creators/SaveDataFileSystemCreator.cs index 958a85a9..68db8482 100644 --- a/src/LibHac/FsService/Creators/SaveDataFileSystemCreator.cs +++ b/src/LibHac/FsService/Creators/SaveDataFileSystemCreator.cs @@ -42,8 +42,10 @@ namespace LibHac.FsService.Creators // if (!allowDirectorySaveData) return ResultFs.InvalidSaveDataEntryType.Log(); var subDirFs = new SubdirectoryFileSystem(sourceFileSystem, saveDataPath); + bool isPersistentSaveData = type != SaveDataType.Temporary; + bool isUserSaveData = type == SaveDataType.Account || type == SaveDataType.Device; - rc = DirectorySaveDataFileSystem.CreateNew(out DirectorySaveDataFileSystem saveFs, subDirFs); + rc = DirectorySaveDataFileSystem.CreateNew(out DirectorySaveDataFileSystem saveFs, subDirFs, isPersistentSaveData, isUserSaveData); if (rc.IsFailure()) return rc; fileSystem = saveFs; diff --git a/src/LibHac/FsSystem/DirectorySaveDataFileSystem.cs b/src/LibHac/FsSystem/DirectorySaveDataFileSystem.cs index 38f9fad7..a1bea99c 100644 --- a/src/LibHac/FsSystem/DirectorySaveDataFileSystem.cs +++ b/src/LibHac/FsSystem/DirectorySaveDataFileSystem.cs @@ -16,11 +16,6 @@ namespace LibHac.FsSystem // ReSharper disable once UnusedAutoPropertyAccessor.Local private bool IsUserSaveData { get; set; } - public static Result CreateNew(out DirectorySaveDataFileSystem created, IFileSystem baseFileSystem) - { - return CreateNew(out created, baseFileSystem, true, true); - } - public static Result CreateNew(out DirectorySaveDataFileSystem created, IFileSystem baseFileSystem, bool isPersistentSaveData, bool isUserSaveData) { @@ -215,6 +210,8 @@ namespace LibHac.FsSystem { lock (Locker) { + if(!IsPersistentSaveData) return Result.Success; + if (OpenWritableFileCount > 0) { // All files must be closed before commiting save data.