]> git.lyx.org Git - features.git/commitdiff
Quote graphics conversion commands correctly.
authorAngus Leeming <leeming@lyx.org>
Sun, 17 Apr 2005 18:41:14 +0000 (18:41 +0000)
committerAngus Leeming <leeming@lyx.org>
Sun, 17 Apr 2005 18:41:14 +0000 (18:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9820 a592a061-630c-0410-9148-cb99ea01b6c8

src/graphics/ChangeLog
src/graphics/GraphicsConverter.C
src/support/ChangeLog
src/support/forkedcall.C

index 3e21eb833f9855d89be1c126d3de25cbc8b605b1..2d32fd615f5d74ec9aebc16d1c7e38e1e82d3144 100644 (file)
@@ -1,3 +1,7 @@
+2005-04-17  Angus Leeming  <leeming@lyx.org>
+
+       * GraphicsConverter.C (c-tor): quote conversion commands correctly.
+
 2005-02-15  Angus Leeming  <leeming@lyx.org>
 
        * GraphicsLoader.C: s/struct/class/ in definition of
index b55e3a7ddf44130e46424c28e2df40974aa67441..4d6466176721e978ba70a6b2f6f2351a28468886 100644 (file)
@@ -167,9 +167,12 @@ Converter::Impl::Impl(string const & from_file,   string const & to_file_base,
 
        if (!success) {
                script_command_ =
-                       "sh " + LibFileSearch("scripts", "convertDefault.sh") +
-                       ' ' + from_format + ':' + from_file + ' ' +
-                       to_format + ':' + to_file_;
+                       "sh " + 
+                       QuoteName(LibFileSearch("scripts", "convertDefault.sh")) +
+                       ' ' +
+                       QuoteName(from_format + ':' + from_file) +
+                       ' ' +
+                       QuoteName(to_format + ':' + to_file_);
 
                lyxerr[Debug::GRAPHICS]
                        << "\tNo converter defined! I use convertDefault.sh\n\t"
@@ -203,8 +206,9 @@ Converter::Impl::Impl(string const & from_file,   string const & to_file_base,
                // We create a dummy command for ease of understanding of the
                // list of forked processes.
                // Note: 'sh ' is absolutely essential, or execvp will fail.
-               script_command_ = "sh " + script_file_ + ' ' +
-                       OnlyFilename(from_file) + ' ' + to_format;
+               script_command_ = "sh " + QuoteName(script_file_) + ' ' +
+                       QuoteName(OnlyFilename(from_file)) + ' ' +
+                       QuoteName(to_format);
        }
        // All is ready to go
        valid_process_ = true;
index e38df865484da2d483f61d9b624a8f65e20cdda4..a4a27f6dc1441ff075eb63c362d5af765fa658e3 100644 (file)
@@ -1,3 +1,10 @@
+2005-04-17  Angus Leeming  <leeming@lyx.org>
+
+       * forkedcall.C (generateChild): do not strip quotes from args on
+       Windows.
+       Wrap lyxerr output inside an if (lyxerr.debugging(Debug::FILES))
+       block.
+
 2005-03-23  Angus Leeming  <leeming@lyx.org>
 
        * Makefile.am (build_package): Solaris sed does not like
index 9f416959e7f8c405ba656113f2a026fe9fe4059b..d13f4dc3f082bfcb1fff351334a439b6f1362804 100644 (file)
@@ -282,11 +282,23 @@ int Forkedcall::generateChild()
                        if (c == ' ')
                                *it = '\0';
                        else if (c == '\'' || c == '"') {
+#if defined (_WIN32)
+                               // How perverse!
+                               // spawnvp *requires* the quotes or it will
+                               // split the arg at the internal whitespace!
+                               // Make shure the quote is a DOS-style one.
+                               *it = '"';
+#else
                                *it = '\0';
+#endif
                                inside_quote = c;
                        }
                } else if (c == inside_quote) {
+#if defined (_WIN32)
+                       *it = '"';
+#else
                        *it = '\0';
+#endif
                        inside_quote = 0;
                }
        }
@@ -303,13 +315,16 @@ int Forkedcall::generateChild()
        argv.push_back(0);
 
        // Debug output.
-       vector<char *>::iterator ait = argv.begin();
-       vector<char *>::iterator const aend = argv.end();
-       lyxerr << "<command>\n";
-       for (; ait != aend; ++ait)
-               if (*ait)
-                       lyxerr << '\t'<< *ait << '\n';
-       lyxerr << "</command>" << std::endl;
+       if (lyxerr.debugging(Debug::FILES)) {
+               vector<char *>::iterator ait = argv.begin();
+               vector<char *>::iterator const aend = argv.end();
+               lyxerr << "<command>\n\t" << line
+                      << "\n\tInterpretted as:\n\n";
+               for (; ait != aend; ++ait)
+                       if (*ait)
+                               lyxerr << '\t'<< *ait << '\n';
+               lyxerr << "</command>" << std::endl;
+       }
 
 #ifndef __EMX__
        pid_t const cpid = ::fork();