Thanks! Now I know how to list a drive, since Dir.new.("/cygdrive/w")
worked. I never ran into this in pickaxe.
Why didn't it just use /c instead of /cygdrive/c ? I've seen this kludge
used several times and it almost make sense (at least as much sense as
windows does overall <grin>).
This just falls in the nuisance category, since one can start at the root
and map out a drive in a portable way.
-----Original Message-----
From: Chris Morris [mailto:chrismo / homemail.com]
Sent: Sunday, November 18, 2001 4:58 PM
To: ruby-talk ML
Subject: [ruby-talk:25805] Re: Ruby in windows
> This is what I get from command line:
>
> C:\>ruby -e'puts Dir.pwd'
> /cygdrive/c
>
> C:\>ruby -e'puts `cmd.exe /c cd`'
> C:\
>
> Shouldn't these agree? Also I have no directory \cygdrive.
cygwin is a compatibility layer that allows the unix-ish stuff of Ruby to
run on Windows. So cygwin 'unix-izes' your drives by prefixing them with
/cygdrive/, then the drive letter without a colon.
Your second example, of course, actually runs cmd.exe, so of course you get
a native result.
There are other ways to currently do Ruby on Windows
(http://www.rubycentral.com/book/win32.html) and there have also been recent
discussions for more native Windows support
(http://www.rubygarden.org/ruby?FutureWindows).
This bit you've hit upon is a bit awkward unfortunately, but I've been using
Ruby on Windows only for some time now and it works great.
Chris