Path.Combine loses drive letter

  • Thread starter Thread starter aleko
  • Start date Start date
A

aleko

Hi all,

Maybe it's just me, but this seems wrong:

Path.Combine("c:\\", "\\") returns "\\"

I would expect the return to be "c:\\". What do you think?

Thanks,

Aleko
 
Maybe it's just me, but this seems wrong:

Path.Combine("c:\\", "\\") returns "\\"

I would expect the return to be "c:\\". What do you think?

Since Path always seems to drop the last \ and since dropping the last
\ on both of those strings results simply in the path "c:", I'd have to
say that without reading the docs I'd expect Path to return "c:".

There must be a good reason why it drops the drive letter, but I don't
know what it is. If you read the documentation literally, it seems to me
that you ought actually to get "c:\\\\", or possibly just "c:\\" (as you
expected). But why it would drop the drive letter, I don't know. Seems
like that's an important part of the path.

Pete
 
Back
Top