]> git.lyx.org Git - features.git/commitdiff
This patch revert part of the code changed in revision 18825. This is needed because...
authorAbdelrazak Younes <younes@lyx.org>
Tue, 10 Jul 2007 15:07:00 +0000 (15:07 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 10 Jul 2007 15:07:00 +0000 (15:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19029 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetInclude.cpp

index 169c8baff8a9561881d61429534e1838457503b2..90f776e2152e7dfd3392c7d1e06873b0b1937582 100644 (file)
@@ -404,9 +404,19 @@ bool loadIfNeeded(Buffer const & buffer, InsetCommandParams const & params)
                // the readonly flag can/will be wrong, not anymore I think.
                if (!fs::exists(included_file.toFilesystemEncoding()))
                        return false;
-               lyx::dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN,
-                       included_file.absFilename() + "|true"));
-               buf = theBufferList().getBuffer(included_file.absFilename());
+               if (use_gui) {
+                       lyx::dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN,
+                               included_file.absFilename() + "|true"));
+                       buf = theBufferList().getBuffer(included_file.absFilename());
+               }
+               else {
+                       buf = theBufferList().newBuffer(included_file.absFilename());
+                       if (!loadLyXFile(buf, included_file)) {
+                               //close the buffer we just opened
+                               theBufferList().close(buf, false);
+                               return false;
+                       }
+               }
                return buf;
        }
        buf->setParentName(parentFilename(buffer));