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

            Unsafe.SkipInit(out FsPath fullPath);

            Result rc = ResolveFullPath(fullPath.Str, path);

            if (rc.IsFailure())
            {
                return(rc);
            }

            lock (Locker)
            {
                rc = BaseFs.OpenFile(out IFile baseFile, fullPath, mode);
                if (rc.IsFailure())
                {
                    return(rc);
                }

                file = new DirectorySaveDataFile(this, baseFile, mode);

                if (mode.HasFlag(OpenMode.Write))
                {
                    OpenWritableFileCount++;
                }

                return(Result.Success);
            }
        }
        protected override Result DoOpenFile(out IFile file, U8Span path, OpenMode mode)
        {
            file = default;

            FsPath fullPath;

            unsafe { _ = &fullPath; } // workaround for CS0165

            Result rc = ResolveFullPath(fullPath.Str, path);

            if (rc.IsFailure())
            {
                return(rc);
            }

            lock (Locker)
            {
                rc = BaseFs.OpenFile(out IFile baseFile, fullPath, mode);
                if (rc.IsFailure())
                {
                    return(rc);
                }

                file = new DirectorySaveDataFile(this, baseFile, mode);

                if (mode.HasFlag(OpenMode.Write))
                {
                    OpenWritableFileCount++;
                }

                return(Result.Success);
            }
        }
Example #3
0
        protected override Result OpenFileImpl(out IFile file, string path, OpenMode mode)
        {
            file = default;
            string fullPath = GetFullPath(PathTools.Normalize(path));

            lock (Locker)
            {
                Result rc = BaseFs.OpenFile(out IFile baseFile, fullPath, mode);
                if (rc.IsFailure())
                {
                    return(rc);
                }

                file = new DirectorySaveDataFile(this, baseFile, mode);

                if (mode.HasFlag(OpenMode.Write))
                {
                    OpenWritableFileCount++;
                }

                return(Result.Success);
            }
        }