Windows: TMP and TEMP environment variables specify a temporary directory.
authorJohannes Sixt <johannes.sixt@telecom.at>
Sun, 22 Jun 2008 09:35:21 +0000 (11:35 +0200)
committerJohannes Sixt <johannes.sixt@telecom.at>
Thu, 26 Jun 2008 06:47:16 +0000 (08:47 +0200)
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
compat/mingw.c
compat/mingw.h

index 28d32969b949a987e88007a5b7fe472ab3f93ac4..3a05fe7da656ebb5d1699937013a1ab517bbee3c 100644 (file)
@@ -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)
index 624b32d1f404229efcbc0e229703e874e6275fdf..a87cc9679cd32dea102034348f77abb6e12e0113 100644 (file)
@@ -145,6 +145,9 @@ int mingw_open (const char *filename, int oflags, ...);
 char *mingw_getcwd(char *pointer, int len);
 #define getcwd mingw_getcwd
 
+char *mingw_getenv(const char *name);
+#define getenv mingw_getenv
+
 struct hostent *mingw_gethostbyname(const char *host);
 #define gethostbyname mingw_gethostbyname