private String NormalizePath(String path, bool useAppBase) { int len = path.Length; if ((len > 7) && (String.Compare(path, 0, "file:", 0, 5, true, CultureInfo.InvariantCulture) == 0)) { // Don't allow "file:\\", because we can't tell the difference // with it for "file:\\" + "\\server" and "file:\\\" + "\localpath" if (path[5] == '\\') { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars")); } int trim; if (path[7] == '/') { trim = 8; } else { trim = 7; } path = path.Substring(trim); } #if !PLATFORM_UNIX if (path.IndexOf(':') == -1) { #else if ((path.Length >= 1) && ((path[0] == '/') || (path[0] == '\\'))) { #endif // !PLATFORM_UNIX if (useAppBase) { String appBase = Value[(int)LoaderInformation.ApplicationBaseValue]; if ((appBase == null) || (appBase.Length == 0)) { throw new MemberAccessException(Environment.GetResourceString("AppDomain_AppBaseNotSet")); } if (_AppBase == null) { _AppBase = NormalizePath(appBase, false); } StringBuilder result = new StringBuilder(); result.Append(_AppBase); int aLen = _AppBase.Length; if (!((_AppBase[aLen - 1] == '/') || (_AppBase[aLen - 1] == '\\'))) { #if !PLATFORM_UNIX if ((aLen > 7) && (String.Compare(_AppBase, 0, "http:", 0, 5, true, CultureInfo.InvariantCulture) == 0)) { result.Append('/'); } else { result.Append('\\'); } #else result.Append('/'); #endif // !PLATFORM_UNIX } result.Append(path); path = result.ToString(); } else { path = Path.GetFullPathInternal(path); } } return(path); }