[Mono-list] Platform comparison

Jonathan Gilbert 2a5gjx302@sneakemail.com
Tue, 09 Mar 2004 00:57:57


Actually, as I understand it, it doesn't do any transformation. It passes
/'s to the underlying filesystem API, because it is supported there.  Yes,
the Win32 API *does* support '/' as a path separator character (Explorer's
support for this is sketchy, though; Explorer has other problems as well,
such as not allowing you to rename a file so that it begins with a dot).
Note also that even in Windows, the framework has
System.IO.Path.AltDirectorySeparatorChar == '/'. I haven't investigate it,
but the framework documentation implies that Rotor sets this to "\\",
despite the fact that, to the best of my knowledge, "\\" is not supported
on Unix as it is a valid character within a pathname component! I quote
from the AltDirectorySeparatorChar MSDN article:

The character stored in this field cannot be in InvalidPathChars. This
field can be set to the same value as DirectorySeparatorChar.
AltDirectorySeparatorChar and DirectorySeparatorChar are both valid for
separating directory levels in a path string.

The value of this field is a backslash ('\') on Unix, and a slash ('/') on
Windows and Macintosh operating systems.

Jonathan

At 10:12 AM 08/03/2004 -0500, you wrote:
>Hi everybody I just wanted to weigh in on this subject.  I have found that
>in the MS .Net framework, it usually doesn't matter what slash character you
>use, because the framework converts it.  Such as if you are in a HTTP URL
>the framework converts "\" to "/".  And if you are working with an IO
>namespace then it converts "/" to "\".  I don't know if Mono does this,
>because I am just starting to use Mono, but there should be some
>normalization in the framework so the programmer doesn't constantly have to
>check these kinds of things IMHO.
>
>-----Original Message-----
>From: mono-list-admin@lists.ximian.com
>[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Rodolfo Campero
>Sent: Monday, March 08, 2004 10:00 AM
>To: jwezel@compumaster.de; mono-list@ximian.com
>Subject: RE: [Mono-list] Platform comparison
>
>Hi Jochen,
>Instead of hard-coding the separator char, you can use 
>System.IO.Path.DirectorySeparatorChar.
>I don't know any guideline, but in general if you are about to do something 
>that you think is not platform-independent, search a bit because is almost 
>sure that there is a platform-independent way to do it.
>Regards,
>Rodolfo
>
>
>>From: "Jochen Wezel" <jwezel@compumaster.de>
>>To: <mono-list@ximian.com>
>>Subject: [Mono-list] Platform comparison
>>Date: Mon, 8 Mar 2004 14:37:41 +0100
>>
>>Hello together!
>>
>>Is there a comparison or guideline for the several platforms regarding
>>what we developers have to pay attention to?
>>For example, Linux uses "/" as directory separator char, Windows uses
>>"\", but what about Mac OS (X)?
>>
>>Or maybe there are other points which are good to know?
>>
>>Jochen
>>_______________________________________________
>>Mono-list maillist  -  Mono-list@lists.ximian.com
>>http://lists.ximian.com/mailman/listinfo/mono-list
>
>_________________________________________________________________
>Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
>http://join.msn.com/?page=features/featuredemail
>
>_______________________________________________
>Mono-list maillist  -  Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>_______________________________________________
>Mono-list maillist  -  Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>