Missing $HOMEPATH gives home as /c/

113 views
Skip to first unread message

Sherpya

unread,
Oct 12, 2011, 10:48:03 PM10/12/11
to msysGit
Hi, I don't have $HOMEPATH variable in my env (windows xp64, it's
supposed to exists on it?)

so the following code in /etc/profile:

# Set up USER's home directory
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="$HOMEDRIVE$HOMEPATH"
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="$USERPROFILE"
fi
fi


sets HOME -> /c/

I force it to be $USERPROFILE, but obviously I lose the fix on each
upgrade.
what is supposed to be 'HOMEPATH'?

Regards

Pat Thoyts

unread,
Oct 13, 2011, 5:14:11 AM10/13/11
to Sherpya, msysGit

The simple solution for you is to set the HOME environment variable to
something useful for your system. Windows usually sets USERPROFILE to
your local profile directory and if you are using "Roaming profiles"
it may set HOMEDRIVE and HOMEPATH to the network drive and directory
path for your roaming data. It is likely that you want HOME set to a
local directory eg: C:\Users\YourLogin

From the documentation on environment variables:
%HOMEDRIVE% System. Returns which local workstation drive letter is
connected to the user's home directory. This variable is set based on
the value of the home directory. The user's home directory is
specified in Local Users and Groups.

%HOMEPATH% System. Returns the full path of the user's home directory.
This variable is set based on the value of the home directory. The
user's home directory is specified in Local Users and Groups.

%USERPROFILE% Local. Returns the location of the profile for the current user.

It looks like we should add a check for the existence of all such
variables before using them although I don't believe I've ever
encountered a system that failed to have these setup already. Could
just be a weird XP64 thing.

Reply all
Reply to author
Forward
0 new messages