Carrotware.CMS.Core.ContentPageHelper.ScrubFilePath C# (CSharp) Method

ScrubFilePath() private static method

private static ScrubFilePath ( string filePath ) : string
filePath string
return string
        private static string ScrubFilePath(string filePath)
        {
            string newFilePath = String.Format("{0}", filePath).Trim().Replace(@"//", @"/").Replace(@"\", @"/");

            string[] newPaths = newFilePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
            newPaths = newPaths.ToList().Select(x => ScrubSpecial(x)).ToArray();
            newFilePath = String.Join("/", newPaths.ToArray());

            if (!newFilePath.StartsWith(@"/")) {
                newFilePath = String.Format("/{0}", newFilePath).Trim();
            }

            return newFilePath;
        }