private String PreProcessURL(String url, bool isFileURL)
{
#if !PLATFORM_UNIX
if (isFileURL) {
// Remove when the Path class supports "\\?\"
url = PreProcessForExtendedPathRemoval(url, true);
}
else {
url = url.Replace('\\', '/');
}
return url;
#else
// Remove superfluous '/'
// For UNIX, the file path would look something like:
// file:///home/johndoe/here
// file:/home/johndoe/here
// file:../johndoe/here
// file:~/johndoe/here
String temp = url;
int nbSlashes = 0;
while(nbSlashes<temp.Length && '/'==temp[nbSlashes])
nbSlashes++;
// if we get a path like file:///directory/name we need to convert
// this to /directory/name.
if(nbSlashes > 2)
temp = temp.Substring(nbSlashes-1, temp.Length - (nbSlashes-1));
else if (2 == nbSlashes) /* it's a relative path */
temp = temp.Substring(nbSlashes, temp.Length - nbSlashes);
return temp;
#endif // !PLATFORM_UNIX
}