Ronald said:
I know, and that's what I am doing anyway. I just thought - after
reading about File::SEPARATOR - that this would be a good way
to pass path parameters on to external processes.
So this is not OS dependend, and within *every* Ruby implementation
it is supposed to be a slash ... not that much sense defining
it as a named constant then, isn't it?
Ronald
You have a point, as I just can't imagine that the file separator used
by Ruby internally will change any time soon (but who knows?). Thinking
about valid use cases, I tried changing the value of this constant, only
to find that File.joint doesn't use the value:
(irb):3: warning: already initialized constant SEPARATOR
=> "\\"=> "\\"
I would have expected the result to be "c:\\My Documents"
So the best use case (in my opinion) of this variable does not work.
This behavior is in direct contradiction with the documentation for
File.join, by the way (Ruby 1.8.6).
I wonder whether this has been fixed in 1.9? It really does seem a bug
that File.join does not use File::SEPARATOR (when the docs say it does).
I looked at the c code of this function, and it does use a variable
called "separator", but it seems changing File::SEPARATOR does not
change the c variable.
Dan