]> git.lyx.org Git - lyx.git/blobdiff - src/bufferlist.C
Fix working of the spellchecker dialog with ispell when there are no
[lyx.git] / src / bufferlist.C
index 7cefba0ba02ef14bd9a359df346f771c419de06e..c5af8316686d4dea579960ac7a608988cf70db86 100644 (file)
@@ -350,6 +350,12 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
        // 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);
@@ -449,7 +455,7 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
                bool templateok = false;
                LyXLex lex(0, 0);
                lex.setFile(tname);
-               if (lex.IsOK()) {
+               if (lex.isOK()) {
                        if (b->readFile(lex)) {
                                templateok = true;
                        }
@@ -477,8 +483,12 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
 
 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)) {