See pathname2, on the RAA.
Regards,
Dan
···
-----Original Message-----
From: Mark J.Reed [mailto:mreed@thereeds.org]
Sent: Wednesday, August 10, 2005 2:01 PM
To: ruby-talk ML
Subject: Re: File::Spec equivalent?
What I'm specificalliy looking for is a version of
File.join() that will join components with backslashes
instead of forward slashes on Windows...
"Berger, Daniel" <Daniel.Berger@qwest.com> writes:
See pathname2, on the RAA.
Great! It was even easier than that - "gem install pathname2" worked like a
charm. Well, ri can't find any doc on it, but other than that . . .
Thanks!
Gems do their docs differently. Type "gem_server" at a command prompt, then browse to http://localhost:8808/\. You'll see a link to the docs there.
Hope that helps.
James Edward Gray II
···
On Aug 10, 2005, at 3:36 PM, Mark J.Reed wrote:
"Berger, Daniel" <Daniel.Berger@qwest.com> writes:
See pathname2, on the RAA.
Great! It was even easier than that - "gem install pathname2" worked like a
charm. Well, ri can't find any doc on it, but other than that . . .
What I'm specificalliy looking for is a version of File.join() that will
join components with backslashes instead of forward slashes on Windows...
Isn't this what File.join is supposed to do? I haven't tried Ruby on
Windows, but the documentation for File.join in Pickaxe is:
"Returns a new string formed by joining the strings using
File::SEPARATOR."
Presumably File::SEPARATOR is defined as backslash on Windows and
forward-slash on *nix machines.
No:
C:\WINDOWS>ruby -e "p [File::SEPARATOR, File.join('a','b')]"
["/", "a/b"]
File.join(*foo).gsub("/", "\\") might do what the OP wanted.
Cheers,
Dave