#include "support/filetools.h"
#include "support/lyxmanip.h"
#include "support/lyxfunctional.h"
+#include "support/LAssert.h"
#include "lyx_gui_misc.h"
#include "lastfiles.h"
#include "debug.h"
// File information about normal file
FileInfo fileInfo2(s);
+ if (!fileInfo2.exist()) {
+ WriteAlert(_("Error!"), _("Cannot open file"),
+ MakeDisplayPath(s));
+ return 0;
+ }
+
// Check if emergency save file exists and is newer.
e += OnlyFilename(s) + ".emergency";
FileInfo fileInfoE(e);
bool templateok = false;
LyXLex lex(0, 0);
lex.setFile(tname);
- if (lex.IsOK()) {
+ if (lex.isOK()) {
if (b->readFile(lex)) {
templateok = true;
}
Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
{
- // make sure our path is absolute
- string const s = MakeAbsPath(filename);
+ // get absolute path of file and add ".lyx" to the filename if
+ // necessary
+ string s = FileSearch(string(), filename, "lyx");
+ if (s.empty()) {
+ s = filename;
+ }
// file already open?
if (exists(s)) {