Afficher un message
Vieux 15/09/2007, 09h45   #12
Terry Poulin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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


  Réponse avec citation
 
Page generated in 0,13046 seconds with 9 queries