HOME and USERPROFILE aliasing under Windows

MRI currently expects the HOME environment variable to be set under
Windows. Various operations involving ~ and Dir will fail if HOME is not
defined.

However, HOME is rarely defined under Windows by default. Instead
USERPROFILE is what normally represents HOME. IronRuby is considering
aliasing HOME to USERPROFILE if HOME isn’t already defined at startup
time.

Does this seem like something reasonable to do in our implementation?

Thanks,
-John

On Wed, Jul 2, 2008 at 12:29 AM, John L. (IRONRUBY)
[email protected] wrote:

MRI currently expects the HOME environment variable to be set under Windows.
Various operations involving ~ and Dir will fail if HOME is not defined.

However, HOME is rarely defined under Windows by default. Instead
USERPROFILE is what normally represents HOME. IronRuby is considering
aliasing HOME to USERPROFILE if HOME isn’t already defined at startup time.

USERPROFILE sometimes matches the location of roaming profiles, and
not the HOMEDRIVE+HOMEPATH used is some NT domains.

Ruby 1.9 uses a different list of options for HOME in case if not
defined:

[ruby-core:12347]

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/12347

"
In 1.9, when ENV[‘HOME’] isn’t set, it will be set using
HOMEDRIVE+HOMEPATH, USERPROFILE, and “Personal” special-folder
if they are all unset."

I think similar approach should be taked by 1.8

But again, those are my comments and only that.

Regards,

Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

John L.:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/12347
Awesome. We’ll match the 1.9 behavior then.
Actually, to clarify this a bit further, we won’t set HOME, instead
we’ll use HOMEDRIVE+HOMEPATH, USERPROFILE, and “Personal” everywhere
that Ruby uses HOME if HOME isn’t defined.

I don’t think we should be setting HOME arbitrarily for the process.

Thanks,
-John

On Wed, Jul 2, 2008 at 1:33 AM, John L. (IRONRUBY)
[email protected] wrote:

[ruby-core:12347]
But again, those are my comments and only that.

Awesome. We’ll match the 1.9 behavior then.

Actually, to clarify this a bit further, we won’t set HOME, instead we’ll use HOMEDRIVE+HOMEPATH, USERPROFILE, and “Personal” everywhere that Ruby uses HOME if HOME isn’t defined.

I don’t think we should be setting HOME arbitrarily for the process.

For me was clear:

ENV[‘HOME’] || ENV[‘HOMEDRIVE’] + ENV[‘HOMEPATH’] ||
ENV[‘USERPROFILE’] for every time user try to do:

File.expand_path(’~’)
Dir.chdir do … end
etc.

Regards,

Luis L.
AREA 17

Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

Luis L.:

"
In 1.9, when ENV[‘HOME’] isn’t set, it will be set using
HOMEDRIVE+HOMEPATH, USERPROFILE, and “Personal” special-folder
if they are all unset."

I think similar approach should be taked by 1.8

But again, those are my comments and only that.

Awesome. We’ll match the 1.9 behavior then.

Thanks,
-John

Hi,

On Wed, Jul 2, 2008 at 12:58 AM, Luis L. [email protected]
wrote:

Ruby 1.9 uses a different list of options for HOME in case if not defined:

[ruby-core:12347]

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/12347

Ah, good. I also noticed one case where MRI still relies on HOME: irb
is actually uses ENV[‘HOME’] only, to find the irbrc file with
customizations, and if it doesn’t find it, irb uses the current dir
(which is kinda weird).

lib/irb/init.rb:

if home = ENV[“HOME”]
yield proc{|rc| home+"/.irb#{rc}"}
end
home = Dir.pwd

So, I ended up explicitly defining HOME on Windows.

Thanks,
–Vladimir

same problem reported at #20475. and i agree that HOME Env should
handle by that class

-Jirapong

On Jul 2, 2008, at 5:31 AM, “John L. (IRONRUBY)”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs