How to get homedir?

I think I was the one that asked about this on Windows. This works for me:

require ‘win32ole’
home_dir = “#{ENV[‘USERPROFILE’]}”

Warm Regards-
Craig

···

-----Original Message-----
From: Austin Ziegler [mailto:austin@halostatue.ca]
Sent: Thursday, April 29, 2004 7:35 AM
To: ruby-talk@ruby-lang.org
Subject: Re: How to get homedir ?

On Thu, 29 Apr 2004 19:14:03 +0900, gabriele renzi wrote:

il Thu, 29 Apr 2004 11:38:55 +0200, “Florent ‘flure’ C.” > flurePASDESPAM@freePASDESPAM.fr ha scritto::

I’m writing an app in ruby/glade and I want to save the configuration
and some data in the directory of the user.
There is the function g_get_home_dir() in the GLib, but I can’t find
the way to call it from ruby :frowning:
Also I need it to function on GNU/Linux, Windows, and hopefully MacOS X.
well, ENV[‘HOME’] works fine on my windows box and linux one

If the Glade g_get_home_dir() call works on both Linux, Windows, and MacOS
X, then you could use Ruby/DL to do that.

ENV[‘HOME’] does NOT work on Windows, by default. This is something that was

discussed not too long ago; I was having problems getting to
www.ruby-talk.org yesterday, but I recommend searching for this on the list
– there is a Win32 API that you can call to get this information.

-austin

austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2004.04.29
* 07.32.12

Moran, Craig M (BAH) wrote:

I think I was the one that asked about this on Windows. This works for me:

require ‘win32ole’
home_dir = “#{ENV[‘USERPROFILE’]}”

There is also HOMESHARE. Some info is at:

http://www.microsoft.com/technet/security/guidance/secmod65.mspx