System.FilePath.joinDrive problem

Neil Mitchell ndmitchell at
Sun Nov 4 07:54:51 EST 2007


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

That does seem very unintuative, but that's drives for you. For
reference, I did follow the C# path functions as a general reference.
The Shell ones are a kind of weird API that isn't in the built in
Win32 API, and don't tend to be used that much.

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

I think the drive behaviour is totally wrong on many levels. If you
use something like Windows CE, then all paths have to be relative -
this is a much better choice. Relative directories/drives are an
artefact of combining an API with a user interface metaphore (the
console) - and as a result are confusing.

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

Perhaps - that does sound sensible. Is "\\file" relative or absolute?
If its absolute, then combining with "C:" should not change anything.
I think in reality its relative in a "drive" sense but absolute in a
"path" sense.

If anyone wants to knock up a design of a new API for these
particularly difficult bits, feel free.



More information about the Libraries mailing list