[PATCH v2] Add a Windows-specific fallback to getenv("HOME");
- From
Stepan Kasal <kasal@ucw.cz>
- Date
- Jun 5, 2014, 08:03 UTC
- Message-ID
- <20140605080317.GA28029@camelia.ucw.cz>
- In-Reply-To
- <538FCAF5.7030102@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de> Date: Wed, 2 Jun 2010 00:41:33 +0200
If HOME is not set, use $HOMEDRIVE$HOMEPATH
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Stepan Kasal <kasal@ucw.cz> ---
Hello Karsten, thanks for your explanation. There are more things to be done, but I hope you can ack this patch as a step forward.
Hello Dscho, I hope you can ack this as well: it is basically equivalent with your patch, tailored according to current upstream fashion, ;-)
Stepan
compat/mingw.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/compat/mingw.c b/compat/mingw.c index a0e13bc..e108388 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1181,6 +1181,11 @@ char *mingw_getenv(const char *name) if (!result) result = getenv_cs("TEMP"); } + if (!result && !strcmp(name, "HOME")) { + struct strbuf buf = STRBUF_INIT; + strbuf_addf(&buf, "%s%s", getenv_cs("HOMEDRIVE"), getenv_cs("HOMEPATH")); + result = strbuf_detach(&buf, NULL); + } return result; }
-- 2.0.0.9635.g0be03cb -- -- *** Please reply-to-all at all times *** *** (do not pretend to know who is subscribed and who is not) *** *** Please avoid top-posting. *** The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free. You received this message because you are subscribed to the Google Groups "msysGit" group. To post to this group, send email to msysgit@googlegroups.com To unsubscribe from this group, send email to msysgit+unsubscribe@googlegroups.com For more options, and view previous threads, visit this group at http://groups.google.com/group/msysgit?hl=en_US?hl=en --- You received this message because you are subscribed to the Google Groups "msysGit" group. To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.