This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Trailing Periods on File Names


> -----Original Message-----
> From: DJ Delorie [mailto:dj@redhat.com]
> Sent: Friday, April 06, 2001 8:35 PM
> To: cygwin@cygwin.com
> Subject: Re: Trailing Periods on File Names
> 
> 
> 
> Bernard Dautrevaux <Dautrevaux@microprocess.com> writes:
> > In fact Windows not exactly ignores periods at the end of 
> file names:
> > writing a filename as "foo." asks windows NOT to search for 
> "foo.exe" or
> > "foo.bat" IF it needs to execute the file... This is allows 
> to execute "foo"
> > instead of "foo.exe" if both exist, just to add some more fun :-)
> 
> That's not windows, that's command.com or cmd.exe.  If you put "." at
> the end, it [wrongly] thinks there's and extension, and only searches
> for that extension, which in this case is blank.

I'm afraid I have to disagree: taken from the documentation of
'CreateProcess':

	If the filename does not contain an extension, .EXE is assumed. 
	If the filename ends in a period (.) with no extension, or the 
	filename contains a path, .EXE is not appended. 

That is not specifically command.com or cmd.exe that do this; that's WIN32
that specifies this behaviour (and implement it itself if you don't search
the PATH by yourself and provide a full path name).

Even under cygwin (at least 1.1.8(0.34/3/2)) I can get the following:

$ cp /usr/bin/ls.exe test1.exe
$ cp /usr/bin/cp.exe test1
$ ls -l test1*
-rwxr-xr-x   1 administ Aucun       63488 Apr  9 12:01 test1
-rwxr-xr-x   1 administ Aucun       62464 Apr  9 12:01 test1.exe
$ PATH=".:$PATH"
$ test1 --help
<skipped the help for ls>
$ test1. --help
<skipped the help for cp>
$ if [ -x test1 ]; then echo "test1 executable"; else echo "test1 not
executable"; fi
test1 executable
$ if [ -x test1. ]; then echo "test1. executable"; else echo "test1 not
executable"; fi
test1. executable
$ rm test1
$ ls -l test1*
-rwxr-xr-x   1 administ Aucun       62464 Apr  9 12:01 test1.exe
$ if [ -x test1. ]; then echo "test1. executable"; else echo "test1. not
executable"; fi
test1. not executable
$ if [ -x test1 ]; then echo "test1 executable"; else echo "test1 not
executable"; fi
test1 executable
$ mv test1.exe test1
mv: `test1.exe' and `test1' are the same file
$ mv test1.exe test1.
$ ls -l test1*
-rwxr-xr-x   1 administ Aucun       62464 Apr  9 12:01 test1
$ if [ -x test1 ]; then echo "test1 executable"; else echo "test1 not
executable"; fi
test1 executable
$ if [ -x test1. ]; then echo "test1. executable"; else echo "test1. not
executable"; fi
test1. executable

It then seems that for cygwin also a trailing "." means "no extension"; what
I don't know is if that is by design (of cygwin) or just an inherited WIN32
"peculiarity" :-)

Regards,

	Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	dautrevaux@microprocess.com
		b.dautrevaux@usa.net
-------------------------------------------- 

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]