Return an error if file-open is called with a non-absolute path

This commit is contained in:
Vincent van Ravesteijn 2013-12-02 21:04:46 +01:00
parent 027b5dc4af
commit 9c4461deea

View File

@ -1572,8 +1572,12 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
validateCurrentView(); validateCurrentView();
// FIXME: create a new method shared with LFUN_HELP_OPEN. // FIXME: create a new method shared with LFUN_HELP_OPEN.
string const fname = to_utf8(cmd.argument()); string const fname = to_utf8(cmd.argument());
bool const is_open = FileName::isAbsolute(fname) if (!FileName::isAbsolute(fname)) {
&& theBufferList().getBuffer(FileName(fname)); dr.setError(true);
dr.setMessage(_("Absolute filename expected."));
break;
}
bool const is_open = theBufferList().getBuffer(FileName(fname));
if (d->views_.empty() if (d->views_.empty()
|| (!lyxrc.open_buffers_in_tabs || (!lyxrc.open_buffers_in_tabs
&& current_view_->documentBufferView() != 0 && current_view_->documentBufferView() != 0