On Thu, Mar 20, 2008 at 05:27:03PM +0900, Alex Young wrote: > > On Thu, 2008-03-20 at 16:05 +0900, Chad Perrin wrote: > > I've got a program that needs to access a file in the ~/etc/ directory. > > This program currently accesses it like so: > > > > file_path = File.expand_path("~#{ENV['USER']}/etc/#{filename}") > > > > . . . but that environment variable just looks hideous in there, at least > > to me. In Perl, I'm used to using getpwuid() instead of $_ENV['user']. > > Is there some equivalent to that in Ruby, or am I stuck with ENV['USER']? > > > > require 'etc' > Etc.getpwuid.dir > > works for me... Hallelujah. That's exactly what I wanted. Thank you much. I don't know why this wasn't working: > ri getpwuid Nothing known about getpwuid -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Kent Beck: "I always knew that one day Smalltalk would replace Java. I just didn't know it would be called Ruby."