summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 28d32969b9..3a05fe7da6 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -366,6 +366,19 @@ char *mingw_getcwd(char *pointer, int len)
return ret;
}
+#undef getenv
+char *mingw_getenv(const char *name)
+{
+ char *result = getenv(name);
+ if (!result && !strcmp(name, "TMPDIR")) {
+ /* on Windows it is TMP and TEMP */
+ result = getenv("TMP");
+ if (!result)
+ result = getenv("TEMP");
+ }
+ return result;
+}
+
/*
* See http://msdn2.microsoft.com/en-us/library/17w5ykft(vs.71).aspx
* (Parsing C++ Command-Line Arguments)