Open temp directory savedata properly

This commit is contained in:
Alex Barney 2020-01-12 14:59:51 -07:00
parent 9c402df18a
commit 5c1a7920d2
2 changed files with 5 additions and 6 deletions

View file

@ -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;

View file

@ -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.