#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 {
using support::dirList;
using support::FileName;
using support::getExtension;
-using support::isFileReadable;
using support::libFileSearch;
using support::libScriptSearch;
using support::makeAbsPath;
using support::makeRelPath;
using support::onlyFilename;
using support::onlyPath;
+using support::package;
using support::prefixIs;
using support::quoteName;
using support::removeExtension;
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;
<< command << endl;
Systemcall one;
one.startscript(Systemcall::Wait, command);
- if (isFileReadable(to_file)) {
+ if (to_file.isFileReadable()) {
if (conversionflags & try_cache)
ConverterCache::get().add(orig_from,
to_format, to_file);
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())
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) {