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:
parent
458284c38f
commit
5614c6bc5b
@ -33,6 +33,7 @@
|
||||
#include "internfile.h"
|
||||
#include "rclmain_w.h"
|
||||
#include "rclzg.h"
|
||||
#include "pathut.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -145,6 +146,9 @@ void RclMain::openWith(Rcl::Doc doc, string cmdspec)
|
||||
// Try to keep the letters used more or less consistent with the reslist
|
||||
// paragraph format.
|
||||
map<string, string> subs;
|
||||
#ifdef _WIN32
|
||||
path_backslashize(fn);
|
||||
#endif
|
||||
subs["F"] = fn;
|
||||
subs["f"] = fn;
|
||||
subs["U"] = url_encode(url);
|
||||
@ -385,6 +389,9 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
||||
// paragraph format.
|
||||
map<string, string> subs;
|
||||
subs["D"] = efftime;
|
||||
#ifdef _WIN32
|
||||
path_backslashize(fn);
|
||||
#endif
|
||||
subs["f"] = fn;
|
||||
subs["F"] = fn;
|
||||
subs["i"] = FileInterner::getLastIpathElt(doc.ipath);
|
||||
|
||||
@ -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] == ':';
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user