summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSven Strickroth <email@cs-ware.de>2012-09-25 00:33:53 +0200
committerSven Strickroth <email@cs-ware.de>2012-09-25 00:33:53 +0200
commitf2b126c76e858be1794c41f9e624ad0d3529432e (patch)
tree2bc22898a8dbd88af94db3b04737b351c4b79cb9 /src
parentc378a1184e8e4cdcffcad3271d650ab12792a6bc (diff)
downloadlibgit2-f2b126c76e858be1794c41f9e624ad0d3529432e.tar.gz
Implemented the full msysgit fallback chain
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Diffstat (limited to 'src')
-rw-r--r--src/fileops.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/fileops.c b/src/fileops.c
index b9044f0a3..a62967d93 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -493,11 +493,20 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
}
}
- if (win32_expand_path(&root, L"%HOMEDRIVE%\\%HOMEPATH%\\") < 0 ||
- root.path[0] == L'%') /* i.e. no expansion happened */
- {
- giterr_set(GITERR_OS, "Cannot locate the user's profile directory");
- return -1;
+ if (getenv("HOMEPATH") != NULL) {
+ if (win32_expand_path(&root, L"%HOMEDRIVE%%HOMEPATH%\\") < 0 ||
+ root.path[0] == L'%') /* i.e. no expansion happened */
+ {
+ giterr_set(GITERR_OS, "Cannot locate the user's profile directory");
+ return -1;
+ }
+ } else {
+ if (win32_expand_path(&root, L"%USERPROFILE%\\") < 0 ||
+ root.path[0] == L'%') /* i.e. no expansion happened */
+ {
+ giterr_set(GITERR_OS, "Cannot locate the user's profile directory");
+ return -1;
+ }
}
if (win32_find_file(path, &root, filename) < 0) {