cygpath -w and .exe magic

Herbert Stocker hersto@gmx.de
Fri Aug 26 16:50:00 GMT 2016


On 26.08.2016 15:08, Nellis, Kenneth wrote:
> Dear Cygwin Community,
>
> $ ls -l
> total 60
> -rwxr-x--- 1 knellis Domain Users 60927 Aug 26 08:57 hello.exe
> $ ./hello
> Hello, world!
> $ cygpath -w hello
> hello
> $
>
> The purpose of cygpath -w, it seems to me, is to provide
> to Windows a valid path given a Posix path.
>
> Given executable file foo.exe, which Cygwin allows to be
> referenced simply as foo, should not: cygpath -w foo
> return: foo.exe
> instead of: foo
> ?
>
> Passing foo to a Windows application will certainly
> be a problem. I recognize this might be considered a
> change of scope for the program, but I think the tool
> should do the .exe magic rather than pass off this
> responsibility to the user. Food for thought.
>

Sounds reasonable, but why shouldn't one have to say .exe
if they mean .exe?
That principle makes things easy.

Just to illustrate a complication of that approach:
Imagine you want to tell a program to safe its data to file foo
and cygpath sees that there is a file Foo.exe, it will make the
Windows program overwrite Foo.exe instead.


And as far as i understand, the reason why Cygwin added this
automatic addition of .exe is not to safe the user 4 key strokes,
but because some programs cannot live without it - i remember
Corinna saying that one cannot run Cygwin programs from cmd.exe
if they don't have the .exe appended - and requiring to specify
the exact name of an executable, i.e. with the .exe would break
each and every script or executable that were written with only
POSIX in mind. They say cp or bash, but not cp.exe or bash.exe .

So Cygwin did this not to make it easy for users,
but out of a dilemma:
   make Cygwin executables available to the Windows world
   vs. not breaking all POSIX programs.

And if you use cygpath, you are writing code for the Windows
environment, and then you can add the .exe where its needed
i think.


best regards,

Herbert Stocker













> --Ken Nellis
>
> --
> 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
>


--
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



More information about the Cygwin mailing list