[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: File.expand_path and ~ on windows

Austin Ziegler

9/19/2003 5:30:00 PM

On Sat, 20 Sep 2003 01:45:14 +0900, Berger, Daniel wrote:
> FWIW, it is possible to set a HOME directory. On XP Pro:
> Control Panel -> User Accounts -> Advanced -> Users.
>
> Then, right click on a given user and click "properties" and click the
> "profile" tab. There you should see a "home folder" option. This is
> what sets the LPUSER_INFO_11 struct value for the usri11_home_dir member.
>
> So, in theory you can get a user's home dir like this:
>
>
> # Available on RAA - shameless plug
> require "sys/win32etc"
> include Sys
>
> home = Win32Etc.getpwnam("some_user").home_dir
>
> However, it seems that in practice this value is rarely set (it wasn't in
> any of the 3 machines that I tested) and that %HOME% should be the first
> default.

In Windows, %HOME% is replaced with %USERPROFILE%.

The "home dir" that you found is related to domain controllers (Windows NT
networking).

-austin
--
austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.09.19
* 13.28.35