On Mon, Dec 02, 2013 at 09:05:41PM +0100, Vincent van Ravesteijn wrote:

> commit 9c4461deea8eabb5bc025a08fa6ce11cb1c9e6fd
> Author: Vincent van Ravesteijn <v...@lyx.org>
> Date:   Mon Dec 2 21:04:46 2013 +0100
> 
>     Return an error if file-open is called with a non-absolute path

I think this is a pretty stupid thing to do. A non-absolute path should
always be interpreted as relative to the current directory (whatever that
is). Introducing these kind of changes in code that has always worked, in
the attempt to fix something that is not broken is dangerous and typically
introduces regressions. For example, now
echo "LYXCMD:test:file-open:a.lyx" > lyxpipe.in
does not work anymore, and scripts that have always been working are now
broken without any good reason.

This change should be reverted, IMNSHO.

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

-- 
Enrico

Reply via email to