Windows GUI: transform file paths to use backslashes before passing them to viewer, as some windows viewers only understand backslashes

This commit is contained in:
Jean-Francois Dockes
2017-01-02 11:18:16 +01:00
parent 458284c38f
commit 5614c6bc5b
3 changed files with 16 additions and 0 deletions
+8
View File
@@ -69,6 +69,14 @@ void path_slashize(string& s)
}
}
}
void path_backslashize(string& s)
{
for (string::size_type i = 0; i < s.size(); i++) {
if (s[i] == '/') {
s[i] = '\\';
}
}
}
static bool path_strlookslikedrive(const string& s)
{
return s.size() == 2 && isalpha(s[0]) && s[1] == ':';
+1
View File
@@ -118,6 +118,7 @@ extern std::string path_pathtofileurl(const std::string& path);
#ifdef _WIN32
/// Convert \ separators to /
void path_slashize(std::string& s);
void path_backslashize(std::string& s);
#endif
/// Lock/pid file class. This is quite close to the pidfile_xxx