Project

General

Profile

Actions

Backport #3630

closed

File.expand_path doesn't expand content of HOME env. variable

Added by tmat (Tomas Matousek) over 13 years ago. Updated about 12 years ago.

Status:
Closed
[ruby-core:31537]

Description

=begin
Dir.chdir 'C:/temp' do
p File.expand_path("a")

ENV["HOME"] = './abc/../xxx'
p File.expand_path("~/a")

ENV["HOME"] = '~/xxx'
p File.expand_path("~/a")
end

Prints:

"C:/temp/a"
"./abc/../xxx/a"
"~/xxx/a"

I'd expect it to print:
"C:/temp/a"
"C:/temp/xxx/a"
"C:/temp/~/xxx/a"

The content of HOME variable should be subject to expansion. If it starts with ~/ the tilde should be treated like a regular directory name to avoid recursion.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0