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 "internfile.h"
|
||||||
#include "rclmain_w.h"
|
#include "rclmain_w.h"
|
||||||
#include "rclzg.h"
|
#include "rclzg.h"
|
||||||
|
#include "pathut.h"
|
||||||
|
|
||||||
using namespace std;
|
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
|
// Try to keep the letters used more or less consistent with the reslist
|
||||||
// paragraph format.
|
// paragraph format.
|
||||||
map<string, string> subs;
|
map<string, string> subs;
|
||||||
|
#ifdef _WIN32
|
||||||
|
path_backslashize(fn);
|
||||||
|
#endif
|
||||||
subs["F"] = fn;
|
subs["F"] = fn;
|
||||||
subs["f"] = fn;
|
subs["f"] = fn;
|
||||||
subs["U"] = url_encode(url);
|
subs["U"] = url_encode(url);
|
||||||
@ -385,6 +389,9 @@ void RclMain::startNativeViewer(Rcl::Doc doc, int pagenum, QString term)
|
|||||||
// paragraph format.
|
// paragraph format.
|
||||||
map<string, string> subs;
|
map<string, string> subs;
|
||||||
subs["D"] = efftime;
|
subs["D"] = efftime;
|
||||||
|
#ifdef _WIN32
|
||||||
|
path_backslashize(fn);
|
||||||
|
#endif
|
||||||
subs["f"] = fn;
|
subs["f"] = fn;
|
||||||
subs["F"] = fn;
|
subs["F"] = fn;
|
||||||
subs["i"] = FileInterner::getLastIpathElt(doc.ipath);
|
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)
|
static bool path_strlookslikedrive(const string& s)
|
||||||
{
|
{
|
||||||
return s.size() == 2 && isalpha(s[0]) && s[1] == ':';
|
return s.size() == 2 && isalpha(s[0]) && s[1] == ':';
|
||||||
|
|||||||
@ -118,6 +118,7 @@ extern std::string path_pathtofileurl(const std::string& path);
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/// Convert \ separators to /
|
/// Convert \ separators to /
|
||||||
void path_slashize(std::string& s);
|
void path_slashize(std::string& s);
|
||||||
|
void path_backslashize(std::string& s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Lock/pid file class. This is quite close to the pidfile_xxx
|
/// Lock/pid file class. This is quite close to the pidfile_xxx
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user