This is the mail archive of the cygwin 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]
Other format: [Raw text]

RE: filename does not exist but test gives true back


What is "WDDTT"?  It's not in OLOCA, wtf doesn't know about it, and Google
gives only 4 hits, none of them relevant.

-----Original Message-----
From: Dave Korn
Sent: Wednesday, April 21, 2004 9:28 AM
To: cygwin@cygwin.com
Subject: RE: filename does not exist but test gives true back

> -----Original Message-----
> From: cygwin-owner On Behalf Of cygwin.20.job
> Sent: 21 April 2004 12:33

> > -----Ursprüngliche Nachricht-----
> > Von: Corinna Vinschen - corinna-cygwin

> > 
> > Trailing dots are silently ignored by Windows.
> > 
> The problem is hat I passed the filename with the trailing 
> dot to a Windows-Program which produced errors and corrupted 
> the file without trailing dot.
> 
> Any idea how to fix it?
> 
> Franz

  I'm afraid this is a case of WDDTT.  You simply can't.  Windoze is utterly
incapable of distinguishing between a filename that ends in a dot and the
same name without a dot at the end: it regards them as exactly the same
name.  This is a leftover from the days of dos 8.3 names; a file called
"file" has no extension, and so for old style short dos names to work, it
has to be possible to refer to it as "file." - that is to say, it has a null
extension, and so the dot is optional.

  Example:

-------->snip!<--------
C:\artimi.src\davek\dot>echo Hello world >file.test

C:\artimi.src\davek\dot>type file.test
Hello world

C:\artimi.src\davek\dot>type file.test.
Hello world

C:\artimi.src\davek\dot>dir
 Volume in drive C has no label.
 Volume Serial Number is 942E-907E

 Directory of C:\artimi.src\davek\dot

21/04/2004  14:21    <DIR>          .
21/04/2004  14:21    <DIR>          ..
21/04/2004  14:21                14 file.test
               1 File(s)             14 bytes
               2 Dir(s)  106,017,673,216 bytes free

C:\artimi.src\davek\dot>dir file.test
 Volume in drive C has no label.
 Volume Serial Number is 942E-907E

 Directory of C:\artimi.src\davek\dot

21/04/2004  14:21                14 file.test
               1 File(s)             14 bytes
               0 Dir(s)  106,017,673,216 bytes free

C:\artimi.src\davek\dot>dir file.test.
 Volume in drive C has no label.
 Volume Serial Number is 942E-907E

 Directory of C:\artimi.src\davek\dot

21/04/2004  14:21                14 file.test
               1 File(s)             14 bytes
               0 Dir(s)  106,017,673,216 bytes free

C:\artimi.src\davek\dot>
-------->snip!<--------

  The *only* solution is to rework your program so it doesn't rely on having
identically-named files that differ only in a trailing dot.  Why not use a
trailing ~ insted?  That's a fairly *nix way of doing things.


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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