Afficher un message
Vieux 14/09/2007, 15h11   #6
Bill Kelly
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: wrong File::SEPARATOR ?


From: "James Edward Gray II" <james@grayproductions.net>
> On Sep 14, 2007, at 5:12 AM, Dan Zwell wrote:
>
>> Ronald Fischer wrote:
>>> On my Ruby 1.8.5 under Windows, I have:
>>> C:> ruby -e 'puts File::SEPARATOR' /
>>> Shouldn't it output '\' instead?


Windows ruby does define ALT_SEPARATOR:

>> File::ALT_SEPARATOR

=> "\\"

(Really a single backslash, self-escaped in the inspect.)


>> Nope, this variable correct because within ruby and its core
>> libraries, everything can open files with forward slash separated
>> paths. Try it.

>
> The truth is that Windows itself understands / as a path separator.
> It's just that many interfaces, like the DOS shells, do not.


Just a potential word of caution going forward... I seem to
recall reading on this list awhile back that the Unicode
file API's in Windows *do not* accept forward slashes for
path separators.

(If that's true, then this may be an issue if Unicode filename
support is ever added to win32 ruby... Although I suppose the
conversion from / to \ could be handled behind the scenes.)


Regards,

Bill



  Réponse avec citation
 
Page generated in 0,05857 seconds with 9 queries