mirror of
https://github.com/git/git.git
synced 2026-02-25 17:33:34 +00:00
Add a Windows-specific fallback to getenv("HOME");
This fixes msysGit issue 482 properly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Karsten Blees
parent
07f88a00e3
commit
24e40baef4
@@ -1828,3 +1828,21 @@ pid_t waitpid(pid_t pid, int *status, int options)
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *get_windows_home_directory()
|
||||
{
|
||||
static const char *home_directory = NULL;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
|
||||
if (home_directory)
|
||||
return home_directory;
|
||||
|
||||
home_directory = getenv("HOME");
|
||||
if (home_directory && *home_directory)
|
||||
return home_directory;
|
||||
|
||||
strbuf_addf(&buf, "%s/%s", getenv("HOMEDRIVE"), getenv("HOMEPATH"));
|
||||
home_directory = strbuf_detach(&buf, NULL);
|
||||
|
||||
return home_directory;
|
||||
}
|
||||
|
||||
@@ -349,3 +349,6 @@ static int mingw_main(c,v)
|
||||
* Used by Pthread API implementation for Windows
|
||||
*/
|
||||
extern int err_win_to_posix(DWORD winerr);
|
||||
|
||||
extern const char *get_windows_home_directory();
|
||||
#define get_home_directory() get_windows_home_directory()
|
||||
|
||||
Reference in New Issue
Block a user