]> git.lyx.org Git - features.git/commitdiff
Fix viewer file paths on windows (bug #8892)
authorGeorg Baum <baum@lyx.org>
Thu, 12 Feb 2015 20:22:21 +0000 (21:22 +0100)
committerGeorg Baum <baum@lyx.org>
Thu, 12 Feb 2015 20:22:21 +0000 (21:22 +0100)
Some applications do not accept forward slashes, so call external viewers
and editors with backward slashes which is the usual convention under windows.

src/Format.cpp
src/support/filetools.cpp
src/support/filetools.h
status.21x

index 9e221be3528ed0d56ec767d1167e276d2ca8f11a..b76ad99ab070c67250ab965bca8f82323f641c13 100644 (file)
@@ -694,8 +694,10 @@ bool Formats::view(Buffer const & buffer, FileName const & filename,
        if (!contains(command, token_from_format))
                command += ' ' + token_from_format;
 
-       command = subst(command, token_from_format, quoteName(onlyFileName(filename.toFilesystemEncoding())));
-       command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
+       command = subst(command, token_from_format,
+                       quoteName(onlyFileName(filename.toFilesystemEncoding()), quote_shell_filename));
+       command = subst(command, token_path_format,
+                       quoteName(onlyPath(filename.toFilesystemEncoding()), quote_shell_filename));
        command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
        LYXERR(Debug::FILES, "Executing command: " << command);
        // FIXME UNICODE utf8 can be wrong for files
@@ -762,8 +764,10 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename,
        if (!contains(command, token_from_format))
                command += ' ' + token_from_format;
 
-       command = subst(command, token_from_format, quoteName(filename.toFilesystemEncoding()));
-       command = subst(command, token_path_format, quoteName(onlyPath(filename.toFilesystemEncoding())));
+       command = subst(command, token_from_format,
+                       quoteName(filename.toFilesystemEncoding(), quote_shell_filename));
+       command = subst(command, token_path_format,
+                       quoteName(onlyPath(filename.toFilesystemEncoding()), quote_shell_filename));
        command = subst(command, token_socket_format, quoteName(theServerSocket().address()));
        LYXERR(Debug::FILES, "Executing command: " << command);
        // FIXME UNICODE utf8 can be wrong for files
index 131e1777675acfdd585d2bc57b51f12b0c05fa17..8f409d7cae9d65b32f99aad56e3be9a146b54d8b 100644 (file)
@@ -178,6 +178,8 @@ string const quoteName(string const & name, quote_style style)
                // simple parser in Systemcall.cpp do the substitution.
                return '"' + subst(name, "\"", "\\\"") + '"';
 #endif
+       case quote_shell_filename:
+               return quoteName(os::external_path(name), quote_shell);
        case quote_python:
                return "\"" + subst(subst(name, "\\", "\\\\"), "\"", "\\\"")
                     + "\"";
index 58d11542d47505b317e0bcb473ef7e504a15da76..bc1561cca4cd8a271fc593a802a19d662d87bdcf 100644 (file)
@@ -110,6 +110,9 @@ enum quote_style {
        /** Quote for the (OS dependant) shell. This is needed for command
            line arguments of subprocesses. */
        quote_shell,
+       /** Quote a file name for the (OS dependant) shell. This is needed
+           for file names as command line arguments of subprocesses. */
+       quote_shell_filename,
        /** Quote for python. Use this if you want to store a filename in a
            python script. Example: \code
            os << "infile = " << quoteName(filename) << '\\n';
index 388bd6510c62dabaeb09fec9a96a6fb153ce5940..eaa85e4c130aa23ec72fec144d45cf44fd9480ac 100644 (file)
@@ -69,6 +69,8 @@ What's new
 - Fix output encoding information for non-TeX fonts XeTeX/LuaTeX on preview
   pane (bug 8919).
 
+- Work around limitations of external image viewers on windows (bug 8892).
+
 
 
 * INTERNALS