Feature #1147
closedFile.expand_path('~') should honor ENV['USERPROFILE'] on Windows
Description
=begin
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 workaround1 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.
=end
Updated by sunaku (Suraj Kurapati) about 15 years ago
=begin
Ack! Please excuse my ignorance.
It seems Ruby 1.9's File.expand_path() already provides
consistent semantics for '~', as the patch1 shows.
This request can be closed. Sorry for the confusion.
=end
Updated by nobu (Nobuyoshi Nakada) about 15 years ago
- Status changed from Open to Closed
=begin
=end