[Mono-list] mono bug?: VolumeSeparatorChar (System.IO.Path)

Gonzalo Paniagua Javier gonzalo@ximian.com
04 Oct 2002 18:25:23 +0200


El vie, 04-10-2002 a las 17:55, Martin Aliger escribió:
>                         char c = path [0];
>                         return (c == DirectorySeparatorChar     ||
>                                 c == AltDirectorySeparatorChar  ||
>                                 (path.Length > 1 && path [1] == VolumeSeparatorChar));
> 
> and both path.Length>1 and path[1]='/' is true.
> 
> Real problem is, that I do not know what MS guys means by setting VolumeSep to '/'on Unixes (as docs says). It makes no sense to me... What about relative paths as "a/b/c/d.exe" ? Full path could be e.g. "/home/alik/mono/a/b/c/d.exe" and everything is ok... I was about to report fix to this as change VolumeSepChar to '\0' (in runtime) but than read MS docs...

Mmm, may be if DirectorySeparatorChar and VolumeSeparator char are the
same character we can avoid the last condition in the if. Any
objections?

> BTW2: in Path.Combine current implementation the condition "
>                         bool b2 = path2 [0] == DirectorySeparatorChar ||
>                                   path2 [0] == AltDirectorySeparatorChar;
> " is always true (checked before with IsPathRooted)

You meant false, right? Because if IsPathRooted returns true, path2 is
returned. I will remove that one.

-Gonzalo