0

Bug in Pathname?

I'm finding that on Windows the pathname returned via a file select has the slashes the wrong way, e.g.:

C:/Documents and Settings/Alex/etc

Which means if you try and call join on that, you get:

C:/Documents and Settings/Alex/etc\foo.json

By calling expand_path, the slashes turn themselves into backward slashes - so that's how I'm working round this at the moment.

Can someone else try and replicate this problem?

1 Reply
  • QUOTE (alexandermaccaw @ Jun 22 2009, 01:33 AM) <{POST_SNAPBACK}>
    I'm finding that on Windows the pathname returned via a file select has the slashes the wrong way, e.g.:

    C:/Documents and Settings/Alex/etc

    Which means if you try and call join on that, you get:

    C:/Documents and Settings/Alex/etc\foo.json

    By calling expand_path, the slashes turn themselves into backward slashes - so that's how I'm working round this at the moment.

    Can someone else try and replicate this problem?


    Hey Alex,

    AFAIK Ruby represents paths internally with forward slashes on win32. Using a standard ruby installation on win32 run this code:
    CODE
    puts Dir.getwd
    puts File.join(Dir.getwd, "foo")


    You should see all paths emitted to include forward slashes, also demonstrates proper File.join() usage.

    does this help?

    very best,
    lloyd
    0
This forum is locked.

Recent Posts

in Support & General Questions