Ejemplo n.º 1
0
        public static Result VerifyHostPath(U8Span path)
        {
            if (path.IsEmpty())
            {
                return(Result.Success);
            }

            if (path[0] != StringTraits.DirectorySeparator)
            {
                return(ResultFs.InvalidPathFormat.Log());
            }

            U8Span path2 = path.Slice(1);

            if (path2.IsEmpty())
            {
                return(Result.Success);
            }

            int skipLength      = PathUtility.GetWindowsPathSkipLength(path2);
            int remainingLength = PathTools.MaxPathLength - skipLength;

            Result rc = PathUtility.VerifyPath(path2.Slice(skipLength), remainingLength, remainingLength);

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

            var normalizer = new PathNormalizer(path, PathNormalizer.Option.PreserveUnc);

            return(normalizer.Result);
        }
Ejemplo n.º 2
0
        public Result OpenFileSystemWithId(out IFileSystem fileSystem, ref FsPath path, TitleId titleId, FileSystemProxyType type)
        {
            fileSystem = default;

            // Missing permission check, speed emulation storage type wrapper, and FileSystemInterfaceAdapter

            bool canMountSystemDataPrivate = false;

            var normalizer = new PathNormalizer(path, GetPathNormalizerOptions(path));

            if (normalizer.Result.IsFailure())
            {
                return(normalizer.Result);
            }

            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            return(FsProxyCore.OpenFileSystem(out fileSystem, normalizer.Path, type, canMountSystemDataPrivate, titleId));
        }