예제 #1
0
        private static bool PathsEqual(string path1, string path2)
        {
#if CLR_2_0 || CLR_4_0
            if (PathUtils.IsWindows())
            {
                return(path1.Equals(path2, StringComparison.InvariantCultureIgnoreCase));
            }
            else
            {
                return(path1.Equals(path2, StringComparison.InvariantCulture));
            }
#else
            if (PathUtils.IsWindows())
            {
                return(path1.ToLower().Equals(path2.ToLower()));
            }
            else
            {
                return(path1.Equals(path2));
            }
#endif
        }
예제 #2
0
 /// <summary>
 /// True if the two paths are the same. However, two paths
 /// to the same file or directory using different network
 /// shares or drive letters are not treated as equal.
 /// </summary>
 public static bool SamePath(string path1, string path2)
 {
     return(string.Compare(Canonicalize(path1), Canonicalize(path2), PathUtils.IsWindows()) == 0);
 }