Castle.MonoRail.TestSupport.MonoRailTestWorkerRequest.MapPath C# (CSharp) Method

MapPath() public method

public MapPath ( String path ) : String
path String
return String
		public override String MapPath(String path)
		{
			String mappedPath;

			if (path == null || path.Length == 0 || path.Equals("/"))
			{
				// asking for the site root
				if ("/".Equals(virtualAppPath))
				{
					// app at the site root
					mappedPath = appPhysicalPath;
				}
				else
				{
					// unknown site root - don't point to app root to avoid double config inclusion
					mappedPath = Environment.SystemDirectory;
				}
			}
			else
			{
				if (path.StartsWith("/") || path.StartsWith("\\"))
				{
					path = path.Substring(1);
				}

				mappedPath = new DirectoryInfo(Path.Combine(appPhysicalPath, path)).FullName;
			}

			mappedPath = mappedPath.Replace('/', Path.DirectorySeparatorChar);

			if (mappedPath.EndsWith(Path.DirectorySeparatorChar.ToString()) && !mappedPath.EndsWith(":\\"))
			{
				mappedPath = mappedPath.Substring(0, mappedPath.Length - 1);
			}

			return mappedPath;
		}