View Ticket
Ticket Hash: 44002a7760cf54060b426865bcdca5b81421cad1
Title: cannot locate home directory - please set the HOMEPATH environment variable
Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2011-05-09 12:55:40
Version Found In: [092d763028] 2010-10-05 10:43:28 UTC
Just seen this on Windows XP 32-bit:
C:\Users\buildbot\Reu2\bin\bga120\build>fossil pull
fossil: cannot locate home directory - please set the HOMEPATH environment variable

I think you want USERPROFILE rather than HOMEPATH. I've never seen HOMEPATH on a Windows machine, but USERPROFILE has been about since Windows 2000 (or earlier).

Adam J Richardson

wolfgang added on 2010-10-07 20:51:08:
On all my windows machines(XP SP2, Win7HP) are the environment variables HOMEPATH and HOMEDRIVE defined. A quick search on the net shows me, that both variables should be defined on windows.

HOMEPATH is only a fallback, fossil searches the following environment variables in the given order: LOCALAPPDATA -> APPDATA -> HOMEPATH

USERPROFILE might be added to this fallback chain, but i think there must be another problem on your machine, because LOCALAPPDATA and APPDATA are not found too.

One remark: i think HOMEPATH in the current implementation might not on work on some installations. HOMEPATH contains only the path (f.e. /Profile/User) and does not give you the drive (c:). So fossil should read %HOMEDRIVE%%HOMEPATH%.

anonymous claiming to be arichardson added on 2010-10-08 08:20:15:
Huh. Seems you're right. How strange, I've never seen the HOME* variables on NT5+ before.

I do have APPDATA but not LOCALAPPDATA. I don't think it can be looking for APPDATA because all sorts of programs would fail if I didn't have that defined.

I would still argue for %USERPROFILE% over %HOMEDRIVE%/%HOMEPATH% because it only references one env var instead of two, and does the exact same thing, it seems.

anonymous added on 2010-10-15 09:17:04:
Here is an interesting discussion on HOMEPATH vs. USERPROFILE.

linky (sfw)

anonymous claiming to be ticica added on 2011-02-01 21:41:17 UTC:
I also had the same problem on Windows 2000, running fossil from a process running as a windows service. Using USERPROFILE as yet another fallback seems to have fixed it. So, in db.c, in function db_open_config, add this: ... if( zHome==0 ){ zHome = getenv("USERPROFILE"); } ...

anonymous added on 2011-05-08 15:57:52 UTC:
Current fossil behaviour causes problems at least on Windows 7. On my system (Win 7 Home Basic 32 bit) HOMEPATH variable contains path, relative to HOMEDRIVE value, while USERPROFILE contains full path including drive name. Using HOMEPATH causes wrong behaviour when fossil invoked on the drive, other than HOMEDRIVE. For example using path \Users\joe from directory D:\someproject makes fossil search user profile directory at D:\Users\joe which is obviously wrong. I believe fossil should rather use USERPROFILE or construct full path by combining HOMEDRIVE and HOMEPATH values.