On Sun, Mar 05, 2017 at 03:19:52PM +0100, Bram Moolenaar wrote: > > 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. > > 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. > > > > 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. Cheers, -- James GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7 2D23 DFE6 91AE 331B A3DB -- -- 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.
