protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode) { file = default; FsPath normalizedPath; unsafe { _ = &normalizedPath; } // workaround for CS0165 Result rc = PathTool.Normalize(normalizedPath.Str, out _, path, false, false); if (rc.IsFailure()) { return(rc); } if (!FileTable.TryOpenFile(normalizedPath, out SaveFileInfo fileInfo)) { return(ResultFs.PathNotFound.Log()); } AllocationTableStorage storage = OpenFatStorage(fileInfo.StartBlock); file = new SaveDataFile(storage, normalizedPath, FileTable, fileInfo.Length, mode); return(Result.Success); }
protected override Result OpenFileImpl(out IFile file, string path, OpenMode mode) { file = default; path = PathTools.Normalize(path); if (!FileTable.TryOpenFile(path, out SaveFileInfo fileInfo)) { return(ResultFs.PathNotFound.Log()); } AllocationTableStorage storage = OpenFatStorage(fileInfo.StartBlock); file = new SaveDataFile(storage, path, FileTable, fileInfo.Length, mode); return(Result.Success); }
protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode) { UnsafeHelpers.SkipParamInit(out file); Unsafe.SkipInit(out FsPath normalizedPath); Result rc = PathTool.Normalize(normalizedPath.Str, out _, path, false, false); if (rc.IsFailure()) { return(rc); } if (!FileTable.TryOpenFile(normalizedPath, out SaveFileInfo fileInfo)) { return(ResultFs.PathNotFound.Log()); } AllocationTableStorage storage = OpenFatStorage(fileInfo.StartBlock); file = new SaveDataFile(storage, normalizedPath, FileTable, fileInfo.Length, mode); return(Result.Success); }