Windows: TMP and TEMP environment variables specify a temporary directory.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Johannes Sixt committed
Jun 22, 2008 at 11:35 UTC
6fd6aec44fe79dff61fd37a5fec2456c5458b574
2 files changed
+16
compat/mingw.c
+13
@@ -366,6 +366,19 @@ char *mingw_getcwd(char *pointer, int len)
366
return ret;
367
}
368
369
+#undef getenv
370
+char *mingw_getenv(const char *name)
371
+{
372
+ char *result = getenv(name);
373
+ if (!result && !strcmp(name, "TMPDIR")) {
374
+ /* on Windows it is TMP and TEMP */
375
+ result = getenv("TMP");
376
+ if (!result)
377
+ result = getenv("TEMP");
378
+ }
379
+ return result;
380
+}
381
+
382
/*
383
* See http://msdn2.microsoft.com/en-us/library/17w5ykft(vs.71).aspx
384
* (Parsing C++ Command-Line Arguments)
compat/mingw.h
+3
@@ -145,6 +145,9 @@ int mingw_open (const char *filename, int oflags, ...);
145
char *mingw_getcwd(char *pointer, int len);
146
#define getcwd mingw_getcwd
147
148
+char *mingw_getenv(const char *name);
149
+#define getenv mingw_getenv
150
+
151
struct hostent *mingw_gethostbyname(const char *host);
152
#define gethostbyname mingw_gethostbyname
153