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 }
private static bool PathsEqual(string path1, string path2) { #if NET_2_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 }
/// <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); }