]> git.lyx.org Git - lyx.git/blobdiff - src/lyx_main.C
move some selection related stuff over to textcursor.C
[lyx.git] / src / lyx_main.C
index 45936db47937951e120d3fd593491ffd24730776..44cd30ab063718c557bd2149a5fcb953f30f5a0d 100644 (file)
@@ -143,21 +143,24 @@ LyX::LyX(int & argc, char * argv[])
 
                Buffer * last_loaded = 0;
 
-               vector<string>::iterator it = files.begin();
-               vector<string>::iterator end = files.end();
+               vector<string>::const_iterator it = files.begin();
+               vector<string>::const_iterator end = files.end();
+
                for (; it != end; ++it) {
-                       last_loaded = bufferlist.newBuffer(*it, false);
+                       // get absolute path of file and add ".lyx" to 
+                       // the filename if necessary
+                       string s = FileSearch(string(), *it, "lyx");
+                       if (s.empty()) {
+                               s = *it;
+                       }
+
+                       last_loaded = bufferlist.newBuffer(s, false);
                        last_loaded->parseError.connect(boost::bind(&LyX::printError, this, _1));
-                       loadLyXFile(last_loaded, *it);
+                       loadLyXFile(last_loaded, s);
                }
 
                files.clear();
 
-               // no buffer loaded, create one
-               string const tmpfile = "tmpfile";
-               if (!last_loaded)
-                       last_loaded = newFile(tmpfile, string());
-
                bool success = false;
 
                // try to dispatch to last loaded buffer first