> Attached is a patch for util.c that corrects an incorrect value for homedrive
> for WINNT. Default was alway "c:" because getenv called for "HOME" instead
> of "HOMEDRIVE".
>
> Even better is to use HOMEDRIVE/HOMEPATH, but because my setup
> has a trailing \ in HOMEPATH I didn't include that in the patch. I'm to lazy,
> I know..
On my NT box, "set" reports:
HOME=C:\Winnt\Profiles\guy
HOMEDRIVE=C:
HOMEPATH=\
USERPROFILE=C:\WINNT\Profiles\guy
The Platform SDK (latest edition, including W2K) speaks, in the
documentation for "FindEnvironmentString()", of USERPROFILE
being available to interactive applications and services, whilst
HOMEDRIVE and HOMEPATH are available only to interactive applications.
It also says that only WINDIR is available in Windows 9x; so it goes.
However, the documentation for "GetWindowsDirectory()" claims that
If an application creates other files that it wants to store
on a per-user bais, it should place them in the directory specified
by the HOMEPATH environment variable. This directory will be different
for each user, if so specified by an administrator, through the
User Manager administrative tool. HOMEPATH always specifies either
the user's home directory, which is guaranteed to be private for
each user, or a default directory (for example, C:\USERS\DEFAULT)
where the user will have all access.
Maybe I need to go tweak stuff with User Manager to make HOMEPATH refer
to my home directory - perhaps it's just my UNIX bias, but I think of
"{Windows directory}\Profiles\<user name>" as a user's home directory
(the Platform SDK seems to imply that "Personal Documents" are stored
under "Personal" in your profile directory - sure sounds like a home
directory to *me*, but maybe Microsoft has some reason why a user
should have some personal stuff under their profile directory and other
personal stuff under a possibly-different home directory, or perhaps
it's just historical noise).
It appears it defaults either to "\" or "\USERS\DEFAULT", depending
on whether NT 4.0 Workstation was installed as the initial OS (as it
was on the NT partition of my machine) or as an upgrade.
I set it to "C:\Winnt\Profiles\Guy".
I think I set HOME explicitly in my environment via the Control Panel
so that Cygwin wouldn't "helpfully" make "%USERPROFILE%\Desktop" my
home directory - again, maybe it's just my UNIX bias, but I wanted it to
be my profile directory, not a "Desktop" subdirectory, as
1) I didn't want all the stuff in my home directory showing up on
my desktop
and
2) my KDE desktop is in a subdirectory of my home directory, and
I think my CDE desktop on my Solaris partition is in a
subdirectory of my home directory, and I didn't see why it should
be different on Windows.
"USERPROFILE" is presumably set to my profile directory.
Then again, Quicken dumped everything, including my data file, into
"C:\QUICKENW" - and still seems to find stuff there even after setting
my home directory to my profile directory - but it's probably really
a Windows 9x application that neither knows nor cares about profile
directories or home directories or any of that multi-user stuff.
The joys of an environment that didn't start out as multi-user....
So, should anything be done with:
"HOME"? Is that at all used in Win32 OSes, except in stuff
ported from UNIX, e.g. CygWin?
"USERPROFILE"? If "HOMEPATH" is "\" or "\USERS\DEFAULT" (with a
case-insensitive comparison), should we assume it hasn't been
set, and fall back on "USERPROFILE"? Or should we either
1) always use "USERPROFILE"
or
2) always use "HOMEPATH"?
(Presumably we default to "C:\" if none of them are set, e.g on W9x,
which has learned, I suspect, even less of the multiuser nature than has
NT.)