Austin Ziegler wrote:
Regardless of the history I am still of the opinion that something
should change. From this thread it seems that Ruby may have chosen to
use / everywhere to keep things consistent. Can anyone confirm that
this really is the decision? If so, it presents the following problems
for Windows users.1) When a program displays paths back to users they all use / instead
of \ which isn't consistent with how the OS presents the paths to
the user.I don't personally see this as an issue. I might think that having a
method #localize for Pathname might be good that does the conversion for
you.2) Trying to run a program in backticks for example with the paths
using / fails.Then backticks, %x{}, and Kernel#system should probably look for / in
the command portion and change it to backslash.
This seems like a reasonable solution to me.
1) Change backticks, %x{}, and Kernel#system to change slashes to
platform's path separator before running commands. Any other things
need this?
2) Add a method to Pathname??? to convert to platform's path separators
for convenience. Anything else need this?
Without at least #1 above it seems slightly broken to me (at least not
what one would expect), since you can have a path to an executable in a
Pathname but then you can't even run the command without doing a gsub on
it's string representation.
···
On 30/12/05, Justin Johnson <justinjohnson@gmail.com> wrote:
I think a reasonable solution would be to allow the programmer to
configure how Ruby will behave, for example by allowing them to change
a global variable for the path separator. I figured this would be
doable but haven't found a way to do so yet. I also still think it
makes more sense to default to the line separater the OS uses, which
is \ for Windows regardless of what the API allows.I disagree completely. Ruby's paths should always use '/' and the pieces
of Ruby which interact with the command-processor and/or the filesystem
should do the separator translation.-austin
--
Posted via http://www.ruby-forum.com/\.