From: Luis Lavena Date: 2009-01-22T01:30:00+09:00 Subject: [ruby-core:21491] Re: [Feature #1027] Dir.home On Wed, Jan 21, 2009 at 2:25 PM, Eero Saynatkari wrote: > Excerpts from Nobuyoshi Nakada's message of Wed Jan 21 05:19:23 +0200 2009: >> Hi, >> >> At Tue, 20 Jan 2009 18:00:00 +0900, >> Kazuhiro NISHIYAMA wrote in [ruby-core:21454]: >> > Portable way of getting home directory is complex see [ruby-core:12347]. >> > I think a simplest getting home directory is >> > Dir.chdir { Dir.pwd } >> > now. >> > But this is not thread-safe and changes directory needlessness. >> >> File.expand_path("~") works. > > A Dir.home might be more idiomatic considering Windows et al. > (And, of course, `File.expand_path ""` does not expand to the > home directory in 1.8.6 at least, which may or may not be > expected.) > The changes File.expand_path("~") has not been backported to 1.8.6, and I believe they will not be. For that purpose, I always set HOME=%HOMEDRIVE%%HOMEPATH% Agree on the idiomatic / Ruby style for Dir.home, that will be a nice addition. -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup�ry