Gary Wright
1/30/2007 4:04:00 PM
On Jan 30, 2007, at 10:10 AM, Ken Bloom wrote:
> Thus, trying to access /home/#{username}/.my_config_file is
> precisely the
> wrong thing to do. Instead, use File.expand_path
> ('~/.my_config_file') or
> #{ENV['HOME']}/.my_config_file
These methods all depend on environment variables. If you need/want to
find this information based on the actual userid and home directory
information maintained by the OS:
require 'etc'
homedir = Etc.getpwuid(Process.uid).dir
Gary Wright