using support::cmd_ret;
using support::createBufferTmpDir;
using support::destroyDir;
+using support::FileName;
using support::getFormatFromContents;
using support::isDirWriteable;
using support::libFileSearch;
bool Buffer::readFile(string const & filename)
{
// Check if the file is compressed.
- string const format = getFormatFromContents(filename);
+ FileName const name(makeAbsPath(filename));
+ string const format = getFormatFromContents(name);
if (format == "gzip" || format == "zip" || format == "compress") {
params().compressed = true;
}
// remove dummy empty par
paragraphs().clear();
LyXLex lex(0, 0);
- lex.setFile(filename);
+ lex.setFile(name);
if (!readFile(lex, filename))
return false;
from_utf8(filename)));
return false;
}
- string const lyx2lyx = libFileSearch("lyx2lyx", "lyx2lyx");
+ FileName const lyx2lyx = libFileSearch("lyx2lyx", "lyx2lyx");
if (lyx2lyx.empty()) {
Alert::error(_("Conversion script not found"),
bformat(_("%1$s is from an earlier"
return false;
}
ostringstream command;
- command << os::python() << ' ' << quoteName(lyx2lyx)
+ command << os::python() << ' ' << quoteName(lyx2lyx.toFilesystemEncoding())
<< " -t " << convert<string>(LYX_FORMAT)
<< " -o " << quoteName(tmpfile) << ' '
<< quoteName(filename);
} else {
// Saving failed, so backup is not backup
if (lyxrc.make_backup)
- rename(s, fileName());
+ rename(FileName(s), FileName(fileName()));
return false;
}
return true;