diff --git a/src/qtgui/rclm_view.cpp b/src/qtgui/rclm_view.cpp index ecba10e3..cc2bab52 100644 --- a/src/qtgui/rclm_view.cpp +++ b/src/qtgui/rclm_view.cpp @@ -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 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 subs; subs["D"] = efftime; +#ifdef _WIN32 + path_backslashize(fn); +#endif subs["f"] = fn; subs["F"] = fn; subs["i"] = FileInterner::getLastIpathElt(doc.ipath); diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp index 9d39a5ef..7af30cbe 100644 --- a/src/utils/pathut.cpp +++ b/src/utils/pathut.cpp @@ -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] == ':'; diff --git a/src/utils/pathut.h b/src/utils/pathut.h index c8482955..e6b9e0cc 100644 --- a/src/utils/pathut.h +++ b/src/utils/pathut.h @@ -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