James McCoy wrote:

> > > > > This just uses the existing logic in mch_can_exe to populate a buffer 
> > > > > with the
> > > > > absolute path to the binary.  The Windows code was already walking
> > > > > $PATH, so it seems pointless not to actually use the information.
> > > > 
> > > > Quite a few years ago I was debugging a Vim that started up slowly.  It
> > > > turned out that walking through $PATH was the main cause for that.  So I
> > > > don't want to walk through $PATH when not really needed.
> 
> You can't tell if it isn't needed unless you walk through $PATH.  If
> there is an item in $PATH that is relative, then an argv[0] of "vim" may
> point to a different binary after changing Vim's working directory.

As mentioned in my other reply, I would be very surprised to find a
relative path in $PATH.  Why would anyone have that?

> > > Then it would be better to use platform-specific functionality to get
> > > the absolute path of the running binary instead of trying to re-use
> > > functionality that's intended for a different purpose.
> > 
> > What platform-specific functionality is there?  Perhaps Linux has a way
> > to get the actual path, instead of using argv[0]?
> 
> At least Windows, Linux, and FreeBSD/macOS have ways to get the absolute
> path of the binary.  We could fallback to mch_can_exe for platforms that
> don't have such a mechanism.

Well, would be good to get the actual binary.  Patches welcome.

> > > > > There's no reason not to behave the same way on non-Windows platforms,
> > > > > so change the code to always use mch_can_exe.  With a small fix to how
> > > > > mch_can_exe determines whether FullName_save is needed.
> > > > 
> > > > I'll merge your change with the fix for Windows.
> > > 
> > > Except my changes weren't merged.  If you have questions about why I did
> > > something, please ask instead of changing it, so that I can explain
> > > before you merge it.  That makes it easier for both of us.
> > 
> > Well, your change didn't look right.  I thought mine did.  So what's
> > better in yours?
> 
> It causes "some/path" to be converted to an absolute path.

Yes, and I thought that is supposed to happen.  I mean, it's the same as
using "./some/path".  Prepending "./" has no change in semantics.

-- 
Over the years, I've developed my sense of deja vu so acutely that now
I can remember things that *have* happened before ...

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui