System.Web.Configuration.WebConfigurationManager.GetParentDir C# (CSharp) Method

GetParentDir() static private method

static private GetParentDir ( string rootPath, string curPath ) : string
rootPath string
curPath string
return string
		static string GetParentDir (string rootPath, string curPath)
		{
			int len = curPath.Length - 1;
			if (len > 0 && curPath [len] == '/')
				curPath = curPath.Substring (0, len);

			if (String.Compare (curPath, rootPath, StringComparison.Ordinal) == 0)
				return null;
			
			int idx = curPath.LastIndexOf ('/');
			if (idx == -1)
				return curPath;

			if (idx == 0)
				return "/";
			
			return curPath.Substring (0, idx);
		}