From: David Masover Date: 2011-06-18T07:29:58+09:00 Subject: Re: default config file location On Friday, June 17, 2011 02:53:23 PM Chad Perrin wrote: > On Sat, Jun 18, 2011 at 04:45:56AM +0900, Matthew K. Williams wrote: > > On Sat, 18 Jun 2011, Chad Perrin wrote: > > >Is there a "better" way to specify a default config file location than > > >this? > > > > > > File.expand_path('~') + "/#{filename}" > > > > Depending on the shell, '~' may not be defined. $HOME is a better > > choice generally. > > I take it you mean the above should be changed to this: > > ENV['HOME'] + "/#{filename}" > > Is that what you mean? As people have pointed out, File.expand_path probably works. I do find this a bit cleaner, though: File.join(ENV['HOME'], filename)