summaryrefslogtreecommitdiffstats
path: root/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32.c')
-rw-r--r--win32.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/win32.c b/win32.c
index 7c9901e..2b7bf7b 100644
--- a/win32.c
+++ b/win32.c
@@ -1093,4 +1093,23 @@ env_set_add_win32 (struct env_set *es)
set_win_sys_path (DEFAULT_WIN_SYS_PATH, es);
}
+
+const char *
+win_get_tempdir()
+{
+ static char buf[MAX_PATH];
+ char *tmpdir = buf;
+
+ CLEAR(buf);
+
+ if (!GetTempPath(sizeof(buf),buf)) {
+ /* Warn if we can't find a valid temporary directory, which should
+ * be unlikely.
+ */
+ msg (M_WARN, "Could not find a suitable temporary directory."
+ " (GetTempPath() failed). Consider to use --tmp-dir");
+ tmpdir = NULL;
+ }
+ return tmpdir;
+}
#endif