private static string GetParentPath(string path)
        {
            var result = PathParser.GetParentPath(path);

            // We specifically want to have a starting '/' in paths
            if (string.IsNullOrEmpty(result))
            {
                return("/");
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        ///   Creates a link to navigate to sub folder
        /// </summary>
        /// <param name="name">Name of the sub folder</param>
        /// <param name="skipLastPart">
        ///   If true the last component of FileBrowserPath is ignored. Used when the last part can be a file
        /// </param>
        /// <returns>A navigation link URL</returns>
        protected string FolderLink(string name, bool skipLastPart = false)
        {
            var browserPath = NonNullPath;

            if (skipLastPart && browserPath.Contains('/'))
            {
                browserPath = PathParser.GetParentPath(browserPath);
            }

            var slash = string.IsNullOrEmpty(browserPath) ? string.Empty : "/";

            return($"{BasePath}{browserPath}{slash}{name}");
        }