Fix bug #8814: Ask for place to export a file if it has not

yet been saved.
This commit is contained in:
Richard Heck 2016-06-25 03:04:59 +01:00
parent 92fae708ae
commit b6d182b81a

View File

@ -3528,16 +3528,20 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
case LFUN_BUFFER_EXPORT: { case LFUN_BUFFER_EXPORT: {
if (!doc_buffer) if (!doc_buffer)
break; 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 // GCC only sees strfwd.h when building merged
if (::lyx::operator==(cmd.argument(), "custom")) { if (::lyx::operator==(cmd.argument(), "custom")) {
dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"), dr); dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"), dr);
break; 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()); exportBufferAs(*doc_buffer, cmd.argument());
break; break;
} }