// todo: Decide how to handle SetBisRootForHost since it allows mounting any directory on the user's computer public static Result SetBisRootForHost(this FileSystemClient fs, BisPartitionId partitionId, U8Span rootPath) { FsPath sfPath; unsafe { _ = &sfPath; } // workaround for CS0165 int pathLen = StringUtils.GetLength(rootPath, PathTools.MaxPathLength + 1); if (pathLen > PathTools.MaxPathLength) { return(ResultFs.TooLongPath.Log()); } if (pathLen > 0) { byte endingSeparator = PathTool.IsSeparator(rootPath[pathLen - 1]) ? StringTraits.NullTerminator : StringTraits.DirectorySeparator; Result rc = new U8StringBuilder(sfPath.Str).Append(rootPath).Append(endingSeparator).ToSfPath(); if (rc.IsFailure()) { return(rc); } } else { sfPath.Str[0] = StringTraits.NullTerminator; } IFileSystemProxy fsProxy = fs.GetFileSystemProxyServiceObject(); return(fsProxy.SetBisRootForHost(partitionId, ref sfPath)); }