]> git.lyx.org Git - features.git/commitdiff
Fix bug #8814: Ask for place to export a file if it has not
authorRichard Heck <rgheck@lyx.org>
Sat, 25 Jun 2016 02:04:59 +0000 (03:04 +0100)
committerRichard Heck <rgheck@lyx.org>
Sat, 25 Jun 2016 02:05:42 +0000 (03:05 +0100)
yet been saved.

src/frontends/qt4/GuiView.cpp

index 87ee553df298e2bdabab384311a4918e542865d5..445678fdc716b068d81ac903628f3d45bbc6b4b7 100644 (file)
@@ -3528,16 +3528,20 @@ 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 (!target_dir.isDirWritable()) {
+
+                       string const dest = cmd.getArg(1);
+                       FileName target_dir;
+                       if (!dest.empty() && FileName::isAbsolute(dest))
+                               target_dir = FileName(support::onlyPath(dest));
+                       else
+                target_dir = doc_buffer->fileName().onlyPath();
+
+                       if (doc_buffer->isUnnamed() || !target_dir.isDirWritable()) {
                                exportBufferAs(*doc_buffer, cmd.argument());
                                break;
                        }