public static int CompareFilePath(this string path, string other)
{
if (other != null && path != null)
{
path = path.ToAvalonPath();
other = other.ToAvalonPath();
if (other.EndsWith("/") && !path.EndsWith("/"))
{
path += "/";
}
else if (path.EndsWith("/") && !other.EndsWith("/"))
{
other +="/";
}
}
switch (PlatformIdentifier)
{
case PlatformID.Win32NT:
// TODO consider using directory info?
if (path == null && other == null)
{
return 0;
}
if (path == null)
{
return 1;
}
if (other == null)
{
return -1;
}
return path.ToLower().CompareTo(other.ToLower());
default:
return path.CompareTo(other);
}
}
}