chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] file-exists? on Windows


From: John Cowan
Subject: Re: [Chicken-users] file-exists? on Windows
Date: Mon, 14 May 2007 15:53:28 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

Kon Lovett scripsit:

> This comes down to a question of platform abstraction. Which I  
> suspect is the unspoken point of Mario's. We do need to remember that  
> whatever their compatibility layers/modes Win32 & MacOS X are not  
> unix. But Chicken does seem to have a bent for providing a common  
> filesystem view so '(file-exists? ".\\")' probably should work on  
> Windows, with a little help from special case handling.

I think a lot of help is required to get this right.  You can strip
trailing backslashes and slashes (Win32 will accept either as a
path delimiter), but faking . and .. in volume roots is not simple.
In particular, "J:\\" might not be a root if it's a mount point
(Windows does have those), and "\\\\foo\\c$" is the root directory
of C: on the local network system named "foo"; the name conventionally
ends in "$" but need not.

IMHO it is not worth working so hard to get this corner case correct;
you will end up reimplementing half of Cygwin.

> Since I use MinGW I think I link w/ the system dlls so the '_stat'  
> implementation is native. I does appear to handle "." & ".."  
> pathnames "correctly", given your point about the trailing directory  
> separator above.

Are you sure?  "." and ".." really do exist in directories that aren't
volume roots.  Try accessing "C:\\.".

-- 
John Cowan   address@hidden  http://www.ccil.org/~cowan
Most languages are dramatically underdescribed, and at least one is
dramatically overdescribed.  Still other languages are simultaneously
overdescribed and underdescribed.  Welsh pertains to the third category.
        --Alan King




reply via email to

[Prev in Thread] Current Thread [Next in Thread]