]> git.lyx.org Git - lyx.git/blobdiff - src/Converter.cpp
adjust
[lyx.git] / src / Converter.cpp
index 3c8842be121bfbaa88f51b39c0a8d8c6c36c0b41..3108d6d286d057bf5ad79f7c3c0f3dfbf190ce00 100644 (file)
 #include "support/filetools.h"
 #include "support/lyxlib.h"
 #include "support/os.h"
+#include "support/Package.h"
 #include "support/Path.h"
 #include "support/Systemcall.h"
 
+using std::endl;
+using std::find_if;
+using std::string;
+using std::vector;
+using std::distance;
+
 
 namespace lyx {
 
@@ -50,6 +57,7 @@ using support::makeAbsPath;
 using support::makeRelPath;
 using support::onlyFilename;
 using support::onlyPath;
+using support::package;
 using support::prefixIs;
 using support::quoteName;
 using support::removeExtension;
@@ -57,12 +65,6 @@ using support::split;
 using support::subst;
 using support::Systemcall;
 
-using std::endl;
-using std::find_if;
-using std::string;
-using std::vector;
-using std::distance;
-
 namespace Alert = lyx::frontend::Alert;
 
 
@@ -363,9 +365,10 @@ bool Converters::convert(Buffer const * buffer,
             cit != edgepath.end(); ++cit) {
                Converter const & conv = converterlist_[*cit];
                bool dummy = conv.To->dummy() && conv.to != "program";
-               if (!dummy)
+               if (!dummy) {
                        LYXERR(Debug::FILES) << "Converting from  "
                               << conv.from << " to " << conv.to << endl;
+               }
                infile = outfile;
                outfile = FileName(conv.result_dir.empty()
                        ? changeExtension(from_file.absFilename(), conv.To->extension())
@@ -379,7 +382,12 @@ bool Converters::convert(Buffer const * buffer,
                FileName real_outfile;
                if (outfile == infile) {
                        real_outfile = infile;
-                       outfile = FileName(addName(buffer->temppath(), "tmpfile.out"));
+                       // when importing, a buffer does not necessarily exist
+                       if (buffer)
+                               outfile = FileName(addName(buffer->temppath(), "tmpfile.out"));
+                       else
+                               outfile = FileName(addName(package().temp_dir().absFilename(),
+                                                  "tmpfile.out"));
                }
 
                if (conv.latex) {