]> git.lyx.org Git - features.git/commitdiff
Fix loop when trying to export a read-only document
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 16 Sep 2013 08:13:16 +0000 (10:13 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 16 Sep 2013 08:13:16 +0000 (10:13 +0200)
src/frontends/qt4/GuiView.cpp

index c9f68f51c2eb6c86c1bbea85546609985ab74e72..a5438b930e45ea8968710c84447001aed373b0db 100644 (file)
@@ -3307,12 +3307,16 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                case LFUN_BUFFER_EXPORT: {
                        if (!doc_buffer)
                                break;
+                       FileName target_dir = doc_buffer->fileName().onlyPath();
+                       string const dest = cmd.getArg(1);
+                       if (!dest.empty() && FileName::isAbsolute(dest))
+                               target_dir = FileName(support::onlyPath(dest));
                        // GCC only sees strfwd.h when building merged
                        if (::lyx::operator==(cmd.argument(), "custom")) {
                                dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"), dr);
                                break;
                        }
-                       if (!doc_buffer->fileName().onlyPath().isDirWritable()) {
+                       if (!target_dir.isDirWritable()) {
                                exportBufferAs(*doc_buffer);
                                break;
                        }