# $home

**URL:** <https://www.ruby-forum.com/t/home/144309>\
**Category:** IronRuby\
**Created:** [July 28, 2008, 3:08pm UTC](https://www.ruby-forum.com/t/home/144309 "2008-07-28T15:08:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![editkid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/977dab/32.png) [@editkid](https://www.ruby-forum.com/u/editkid)\
**Post date:** [July 28, 2008, 3:08pm UTC](https://www.ruby-forum.com/t/home/144309/1 "2008-07-28T15:08:09Z")

</div>

By the way, this is how $HOME is setup in mspec (on Windows):

```
# Code to setup HOME directory correctly on Windows

# This duplicates Ruby 1.9 semantics for defining HOME

platform_is :windows do

  if ENV['HOME']

    ENV['HOME'] = ENV['HOME'].tr '\\', '/'

  elsif ENV['HOMEDIR'] && ENV['HOMEDRIVE']

    ENV['HOME'] = File.join(ENV['HOMEDRIVE'], ENV['HOMEDIR'])

  elsif ENV['HOMEDIR']

    ENV['HOME'] = ENV['HOMEDIR']

  elsif ENV['HOMEDRIVE']

    ENV['HOME'] = ENV['HOMEDRIVE']

  elsif ENV['USERPROFILE']

    ENV['HOME'] = ENV['USERPROFILE']

  else

    puts "No suitable HOME environment found. This means that all of

```

HOME, HOMEDIR, HOMEDRIVE, and USERPROFILE are not set"

```
    exit 1

  end

end
```

---

<div class="post-metadata">

**Author:** ![editkid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/977dab/32.png) [@editkid](https://www.ruby-forum.com/u/editkid)\
**Post date:** [July 29, 2008, 12:27am UTC](https://www.ruby-forum.com/t/home/144309/2 "2008-07-29T00:27:46Z")

</div>

That’s wrong.

The order should be:

HOME  
USERPROFILE  
HOMEDRIVE + HOMEDIR

Using HOMEDIR without HOMEDRIVE (and the opposite) are bad ideas.

On Mon, Jul 28, 2008 at 6:07 AM, Peter Bacon D. \<

---

<div class="post-metadata">

**Author:** ![editkid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/977dab/32.png) [@editkid](https://www.ruby-forum.com/u/editkid)\
**Post date:** [July 29, 2008, 9:56am UTC](https://www.ruby-forum.com/t/home/144309/3 "2008-07-29T09:56:17Z")

</div>

So the question is, â€œGiven that this is in mspec and it claims to  
reproduce Ruby 1.9 semantic, who do we send the bug report to?â€

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Brad W.  
Sent: Monday,28 July 28, 2008 23:18  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] $HOME

That’s wrong.

The order should be:

HOME  
USERPROFILE  
HOMEDRIVE + HOMEDIR

Using HOMEDIR without HOMEDRIVE (and the opposite) are bad ideas.

On Mon, Jul 28, 2008 at 6:07 AM, Peter Bacon D.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

By the way, this is how $HOME is setup in mspec (on Windows):

```
# Code to setup HOME directory correctly on Windows

# This duplicates Ruby 1.9 semantics for defining HOME

platform_is :windows do

  if ENV['HOME']

    ENV['HOME'] = ENV['HOME'].tr '\\', '/'

  elsif ENV['HOMEDIR'] && ENV['HOMEDRIVE']

    ENV['HOME'] = File.join(ENV['HOMEDRIVE'], ENV['HOMEDIR'])

  elsif ENV['HOMEDIR']

    ENV['HOME'] = ENV['HOMEDIR']

  elsif ENV['HOMEDRIVE']

    ENV['HOME'] = ENV['HOMEDRIVE']

  elsif ENV['USERPROFILE']

    ENV['HOME'] = ENV['USERPROFILE']

  else

    puts "No suitable HOME environment found. This means that all of 

```

HOME, HOMEDIR, HOMEDRIVE, and USERPROFILE are not set"

```
    exit 1

  end

end

```

---

<div class="post-metadata">

**Author:** ![editkid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/977dab/32.png) [@editkid](https://www.ruby-forum.com/u/editkid)\
**Post date:** [July 29, 2008, 9:58am UTC](https://www.ruby-forum.com/t/home/144309/4 "2008-07-29T09:58:41Z")

</div>

Ruby 1.9 actually uses this order:

HOME

HOMEDRIVE + HOMEPATH

HOMEPATH

USERPROFILE

SHGetSpecialFolderLocation(NULL, CSIDL\_PERSONAL, &pidl)

This seems reasonable. I suspect mspec needs tweaking.

Pete

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Brad W.  
Sent: Monday,28 July 28, 2008 23:18  
To: removed\_email\_address@domain.invalid  
Subject: Re: [Ironruby-core] $HOME

That’s wrong.

The order should be:

HOME  
USERPROFILE  
HOMEDRIVE + HOMEDIR

Using HOMEDIR without HOMEDRIVE (and the opposite) are bad ideas.

On Mon, Jul 28, 2008 at 6:07 AM, Peter Bacon D.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

By the way, this is how $HOME is setup in mspec (on Windows):

```
# Code to setup HOME directory correctly on Windows

# This duplicates Ruby 1.9 semantics for defining HOME

platform_is :windows do

  if ENV['HOME']

    ENV['HOME'] = ENV['HOME'].tr '\\', '/'

  elsif ENV['HOMEDIR'] && ENV['HOMEDRIVE']

    ENV['HOME'] = File.join(ENV['HOMEDRIVE'], ENV['HOMEDIR'])

  elsif ENV['HOMEDIR']

    ENV['HOME'] = ENV['HOMEDIR']

  elsif ENV['HOMEDRIVE']

    ENV['HOME'] = ENV['HOMEDRIVE']

  elsif ENV['USERPROFILE']

    ENV['HOME'] = ENV['USERPROFILE']

  else

    puts "No suitable HOME environment found. This means that all of 

```

HOME, HOMEDIR, HOMEDRIVE, and USERPROFILE are not set"

```
    exit 1

  end

end

```
