Feature #1147: File.expand_path('~') should honor ENV['USERPROFILE'] on Windows
http://redmine.ruby-lang.org/issues/show/1147

Author: Suraj Kurapati
Status: Open, Priority: Normal

Please improve File.expand_path() to look for ENV['USERPROFILE']
(which is the path to the user's home directory on windows) if
ENV['HOME'] is not defined.

This will give consistent semantics to '~' (represents the home
directory of the current user), just like '/' has consistent 
semantics on both UNIX and Windows (represents the directory
separator -- even though Windows' directory separator is "\\").

A workaround[1] for this problem is already found in Ruby 1.9.  I
do not wish to write such a workaround in every Ruby project, when
the problem can be fixed (once!) in Ruby itself.

Also, if I may have a wish :-), perhaps a Dir::home() method could
be added to Ruby 1.9, which would return the path to the current 
user's home directory.  This is in similar spirit to Dir::pwd()
which returns the path to the current working directory.

Thanks for your consideration.

[1]: http://redmine.ruby-lang.org/repositories/diff/ruby-19?rev=21312


----------------------------------------
http://redmine.ruby-lang.org