protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
        {
            UnsafeHelpers.SkipParamInit(out file);

            if (!FileTable.TryOpenFile(path.ToString(), out RomFileInfo info))
            {
                return(ResultFs.PathNotFound.Log());
            }

            if (mode != OpenMode.Read)
            {
                // RomFs files must be opened read-only.
                return(ResultFs.InvalidArgument.Log());
            }

            file = new RomFsFile(BaseStorage, Header.DataOffset + info.Offset, info.Length);
            return(Result.Success);
        }
Exemple #2
0
        protected override Result OpenFileImpl(out IFile file, string path, OpenMode mode)
        {
            file = default;
            path = PathTools.Normalize(path);

            if (!FileTable.TryOpenFile(path, out RomFileInfo info))
            {
                return(ResultFs.PathNotFound.Log());
            }

            if (mode != OpenMode.Read)
            {
                // RomFs files must be opened read-only.
                return(ResultFs.InvalidArgument.Log());
            }

            file = new RomFsFile(BaseStorage, Header.DataOffset + info.Offset, info.Length);
            return(Result.Success);
        }