Index: /trunk/include/iprt/path.h
===================================================================
--- /trunk/include/iprt/path.h	(revision 20017)
+++ /trunk/include/iprt/path.h	(revision 20018)
@@ -455,4 +455,13 @@
 
 /**
+ * Gets the temporary directory path.
+ *
+ * @returns iprt status code.
+ * @param   pszPath     Buffer where to store the path.
+ * @param   cchPath     Buffer size in bytes.
+ */
+RTDECL(int) RTPathTemp(char *pszPath, size_t cchPath);
+
+/**
  * Query information about a file system object.
  *
Index: /trunk/src/VBox/Runtime/r3/path.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r3/path.cpp	(revision 20017)
+++ /trunk/src/VBox/Runtime/r3/path.cpp	(revision 20018)
@@ -42,4 +42,5 @@
 #include <iprt/err.h>
 #include <iprt/uni.h>
+#include <iprt/env.h>
 #include "internal/fs.h"
 #include "internal/path.h"
@@ -963,4 +964,34 @@
 }
 
+/**
+ * Gets the temporary directory path.
+ *
+ * @returns iprt status code.
+ * @param   pszPath     Buffer where to store the path.
+ * @param   cchPath     Buffer size in bytes.
+ */
+RTDECL(int) RTPathTemp(char *pszPath, size_t cchPath)
+{
+    char *pszResult;
+    int rc;
+    const char *pszTmpEnv = RTEnvGet("TMP");
+    if (!pszTmpEnv)
+        pszTmpEnv = RTEnvGet("TEMP");
+    char *pszTmpDir;
+    /* Make a copy in any case. */
+    if (pszTmpEnv)
+        pszTmpDir = RTStrDup(pszTmpEnv);
+    else
+        pszTmpDir = RTStrDup("/tmp");
+
+    size_t cchTmpDir = strlen(pszTmpDir);
+    if (cchTmpDir < cchPath)
+        memcpy(pszPath, pszTmpDir, cchTmpDir + 1);
+    else
+        rc = VERR_BUFFER_OVERFLOW;
+    RTStrFree(pszTmpDir);
+    return rc;
+}
+
 #endif /* !RT_MINI */
 
