Project

General

Profile

Actions

Feature #1147

closed

File.expand_path('~') should honor ENV['USERPROFILE'] on Windows

Added by sunaku (Suraj Kurapati) about 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:22026]

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

Actions #1

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

Actions #2

Updated by nobu (Nobuyoshi Nakada) about 15 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0