Fix computation of file:// urls from paths

--HG--
branch : WINDOWSPORT
This commit is contained in:
Jean-Francois Dockes
2015-09-02 09:11:25 +02:00
parent a66209dc6e
commit 8022515a00
8 changed files with 29 additions and 4 deletions
+12
View File
@@ -22,6 +22,7 @@
#include "safefcntl.h"
#include "safeunistd.h"
#include "dirent.h"
#include "cstr.h"
#ifdef _WIN32
#include "safewindows.h"
#else
@@ -818,6 +819,17 @@ string fileurltolocalpath(string url)
return url;
}
string path_pathtofileurl(const string& path)
{
// We're supposed to receive a canonic absolute path, but on windows we
// may need to add a '/' in front of the drive spec
string url(cstr_fileu);
if (path.empty() || path[0] != '/')
url.push_back('/');
url += path;
return url;
}
bool urlisfileurl(const string& url)
{
return url.find("file://") == 0;