[Mono-list] How to get user's HOME directory

Gaurav Vaish gvaish@adobe.com
Fri, 4 Apr 2003 11:51:17 +0530


Though it may not be a good / fool-proof idea, but generally the users don't
change "Application Data" folder. btw, can they?

    In this scenario, use:
        Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

    and then strip off "Application Data".

    Or better still (thanks Simon, for the idea):

    Check for if the OS is Windows, then get the environment variable
"USERPROFILE" or else if it's UNIX then get the value of "HOME".


Happy Hacking,
Gaurav
http://mastergaurav.virtualave.net/iitk
---------------------------------------


----- Original Message -----
From: "Simon Waite" <simon@psionics.demon.co.uk>
To: <mono-list@lists.ximian.com>
Sent: Friday, April 04, 2003 07:30
Subject: Re: [Mono-list] How to get user's HOME directory


> marcus:
>
> Lo marcus! Long time no speak!
>
>
> Stefan:
> Typing set at the command prompt will give you something like:
>
> HOME=%USERPROFILE%
> HOMEDRIVE=C:
> HOMEPATH=\Documents and Settings\simon
> USERDOMAIN=LAN
> USERNAME=simon
> USERPROFILE=C:\Documents and Settings\simon
>
> If you're not using NT/2K/XP all bets are off. Win9x/ME don't have the
> concept
> of $HOME
>
> However, YMMV.
>
>
> Right 3am, time for bed :-)
>
> nn
>
> -Simon
>
> ----- Original Message -----
> From: "Marcus" <mathpup@mylinuxisp.com>
> To: "Stefan Saring" <stefan.saring@epost.de>
> Cc: <mono-list@lists.ximian.com>
> Sent: Friday, April 04, 2003 2:03 AM
> Subject: Re: [Mono-list] How to get user's HOME directory
>
>
> > On Thursday 03 April 2003 06:55 am, Stefan Saring wrote:
> >
> > > is there any way to get the name of the user's HOME directory with
mono
> > > ? (something like System.Environment.CurrentDirectory ...)
> > > I know that I can use
System.Environment.GetEnvironmentVariable("HOME"),
> > > but this might only work on Unix systems.
> >
> > Do Windoze platforms have the concept of a "home directory"?
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>