This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: PATHEXT is fundamental to Windows and Should be recognised by CYGWIN
On Aug 8, 2016, at 8:00 AM, Erik Soderquist <ErikSoderquist@gmail.com> wrote:
>
> On Mon, Aug 8, 2016 at 9:52 AM, Erik Soderquist wrote:
>> On Sun, Aug 7, 2016 at 4:11 AM, Herbert Stocker wrote:
>>>>
>>>> code required to handle .exe and .lnk extensions you don't *want*
>>>> PATHEXT support anymore.
>>>
>>> Moreso, this code has recently broken my C++ code in Cygwin.
>>> It tried to see if a directory /dir/subdir/something existed,
>>> and Cygwin said yes because it found a /dir/subdir/something.exe .
>>> So my program failed.
>>
>> Were you testing for the existence of a *directory* (
>> /dir/subdir/something/. ) or for anything named *something* in
>> /dir/subdir/ ?
[snip]
> $ touch /tmp/foo.exe
>
> $ if [ -e /tmp/foo ] ; then echo yes ; else echo no ; fi
> yes
Yes, but:
$ if [ -d /tmp/foo ] ; then echo yes ; else echo no ; fi
no
The existence check is because foo == foo.exe == foo.lnk under Cygwin, but the original complaint came from someone checking for a directory. So, the lesson is, fix the stat(2)/test(1) call, don’t change Cygwin to cope with a bad test.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple