System.FilePath.joinDrive problem

Twan van Laarhoven twanvl at gmail.com
Sat Nov 3 19:33:44 EDT 2007


Seth Kurtzberg wrote:

> I find it esthetically displeasing, but Bulat is correct; it is relied on in
> many situations by many programs.

It is not the "C:File" filename itself I have a problem with, but rather 
that "C:" </> "File" == "C:File".

When you are combining "C:" with a filename you are treating it as a 
kind of directory name. Almost all windows programs *will* treat "C:" 
the same as "C:\", and from the user's point of view this is IMO correct.

The reason I came upon this problem was that my %ProgramFiles% was set 
to "E:". For years this has worked without incident, all programs handle 
this just fine. The only program that doesn't accept this is cabal.


On the other hand, many other functions do treat "C:" as a kind of 
relative path name, from that view the current behaviour makes sense.

Anyway, I am prepared to admit that I am wrong and that FilePath's 
behaviour is in fact correct. I guess drive names just really suck.


A thing that is even more unexpected is:
 >  "C:" </> "\\file" == "\\file"

A path like "\\file" is relative to the current drive. Giving a drive 
letter should make it completely absolute.

Twan


More information about the Libraries mailing list