Re: Applications Messaging Standard

From: John Taylor <jontayler-at-gmail.com>
Date: Thu, 15 Feb 2007 21:03:49 +0000


Correcting my earlier comment about C#:

On 15 Feb 2007, at 20:34, Alasdair Allan wrote:

>
> John Taylor wrote:
>> Funnily enough...it does seem to be missing from Windows. In
>> Csharp there's an object that gives you access to a whole load of
>> interesting places on the file system: the desktop, the temp
>> folder etc....but I'm buggered if I can find one that equates to
>> ~jdt. I'm no expert though, so I could have missed it.
>
> How odd, certainly there is the concept of the home directory under
> Windows at the OS level. For instance see the list of system
> environment variables about half way down the page at,
>
> http://www.microsoft.com/resources/documentation/windows/xp/all/
> proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true
>
> Al.

This rather convoluted line will do the trick:

string sPath =System.Environment.GetEnvironmentVariable("HOMEDRIVE") + System.Environment.GetEnvironmentVariable("HOMEPATH");

I had been using this enumeration:
http://msdn2.microsoft.com/en-us/library/ system.environment.specialfolder.aspx

which is far cleaner, but unaccountably fails to give the home folder. Received on 2007-02-15Z22:04:12