internal static string CanonicalizePath(string path, bool needFullPath)
{
if (needFullPath)
{
string text = Path.GetFullPathInternal(path);
if (path.EndsWith(StringExpressionSet.m_directorySeparator.ToString() + ".", StringComparison.Ordinal))
{
if (text.EndsWith(StringExpressionSet.m_directorySeparator))
{
text += ".";
}
else
{
text = text + StringExpressionSet.m_directorySeparator.ToString() + ".";
}
}
path = text;
}
else if (path.IndexOf('~') != -1)
{
string text2 = null;
StringExpressionSet.GetLongPathName(path, JitHelpers.GetStringHandleOnStack(ref text2));
path = ((text2 != null) ? text2 : path);
}
if (path.IndexOf(':', 2) != -1)
{
throw new NotSupportedException(Environment.GetResourceString("Argument_PathFormatNotSupported"));
}
return(path);
}