Skip to content

Instantly share code, notes, and snippets.

@afrokick
Created December 4, 2015 15:24
Show Gist options
  • Save afrokick/e2493a07aa96c42e5e77 to your computer and use it in GitHub Desktop.
Save afrokick/e2493a07aa96c42e5e77 to your computer and use it in GitHub Desktop.
public static string ConvertPathToUrl(string path)
{
string url;
if (path.StartsWith("/"))
{
url = "file://" + path;
}
else if (path.StartsWith("file:///"))
{
url = path;
}
else
{
url = "file:///" + path;
}
return url.Replace("\\", "/");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment