From: Terry Poulin Date: 2007-09-15T16:45:36+09:00 Subject: Re: Cross-platform Home Directory? Olivier Renaud wrote: > Trans a �crit : >> I have a little app that needs to store session data. I assume the >> best place to store it is in one's home directory, but I need this app >> to be cross-platform. I glanced through all rbconfig.rb's >> Config::CONFIG settings but did not see anything for it. How does one >> access a cross-platform home directory? >> >> Thanks, >> T. >> > This is how I do this : > home_directory = Dir.chdir {|path| path} > > The doc for Dir.chdir says that without argument, this method looks for > environnement variables HOME or LOGDIR. And with a block, the directory > is changed only inside the block, and restored right after. > > -- > Olivier Renaud > > At first I would just check ENV to see if HOME or USERPROFILE was set. Then some one told me about the Platform gem :-) You know, the OOP thing gives me a nice idea of how to use that hehe. TerryP. -- Email and shopping with the feelgood factor! 55% of income to good causes. http://www.ippimail.com