[prev in list] [next in list] [prev in thread] [next in thread]
List: vim
Subject: Re: executable()
From: Walter Briscoe <wbriscoe () ponle ! demon ! co ! uk>
Date: 2004-06-19 8:23:40
Message-ID: 6zda7rGMg$0AFwut () ponle ! demon ! co ! uk
[Download RAW message or body]
In message <200406181230.i5ICUPoC041267@moolenaar.net> of Fri, 18 Jun
2004 14:30:25 in , Bram Moolenaar <Bram@moolenaar.net> writes
>
>Alex Jakushev wrote:
>
>> I use vim 6.3 on Windows XP and win98.
>>
>> I noticed that the way function executable() works
>> differs on different systems:
>>
>> on winXP, I may test for executable('myprog'), and I'll
>> get positive answer if myprog.exe exists in the path.
>>
>> However, this does not work on win98, i have to test for
>> executable('myprog.exe') to get positive answer.
>>
>> Is this a a bug or OS dependent?
>>
>> Logically speaking, the way it works on XP is better,
>> because, although the full file name is myprog.exe, i can
>> launch it by simply enetring "myprog".
>
>It sounds like this is a bug in the Win32 FindExecutable() function.
>The source code already mentions that FindExecutableA() doesn't work on
>Windows NT. Normally FindExecutableA() and FindExecutableW() should do
>the same thing, but it appears this isn't true.
>
>Is there someone who knows the details?
>
I think FindExecutable is being used by vim in a fashion which is
inconsistent with its documentation where I read
FindExecutable Retrieves the name of and handle to the executable (.exe)
file associated with the specified file name.
...
Parameters lpFile Address of a null-terminated string specifying a file
name. This should be a document.
Are you comfortable that :echo('foo.doc') can return 1 on an NT system?
foo.doc exists and does not designate an executable file but an
executable file can be found to process foo.doc.
I will explore the behaviour of FindExecutable[AW] in Windows 9[58].
I have just looked at a 98SE COMMAND.COM. Like its predecessors (at
least as far back as MS-DOS 5.0), it contains the character sequence
".COM.EXE.BAT". I infer that when asked to run foo, it (like them) tries
foo.COM, foo.EXE and foo.BAT in turn.
os_msdos.c uses searchpath() where os_win32.c uses FindExecutable[AW].
I found Borland 3.1 documentation of searchpath(). It does not mention
what happens when the supplied argument does not have an extension.
I think that vim's executable() should achieve the same as COMMAND.COM
does when given a bare name such as foo. On old systems, this may be
done with 1 call but is more likely to involve 3. Do you agree?
If you do, I will check the behaviour on W9X systems, adjust as
necessary and post any suggested change to the vim-dev mailing list.
No test script tests executable(). dos.vim uses it in passing to check
for vim.exe. A large amount of work would be needed to test to this
level and, I infer, is unlikely to be profitable.
--
Walter Briscoe
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic