Import mkdtemp gnulib module, fix mingw build
[deliverable/binutils-gdb.git] / gdb / common / pathstuff.c
index 48ff861edaed82f81b99e8248d41352a86fb4260..839197583bfaea22e7e0f9ec9cce063eb032d92e 100644 (file)
@@ -193,6 +193,31 @@ get_standard_cache_dir ()
 
 /* See common/pathstuff.h.  */
 
+std::string
+get_standard_temp_dir ()
+{
+#ifdef WIN32
+  const char *tmp = getenv ("TMP");
+  if (tmp != nullptr)
+    return tmp;
+
+  tmp = getenv ("TEMP");
+  if (tmp != nullptr)
+    return tmp;
+
+  error (_("Couldn't find temp dir path, both TMP and TEMP are unset."));
+
+#else
+  const char *tmp = getenv ("TMPDIR");
+  if (tmp != nullptr)
+    return tmp;
+
+  return "/tmp";
+#endif
+}
+
+/* See common/pathstuff.h.  */
+
 const char *
 get_shell ()
 {
This page took 0.025269 seconds and 4 git commands to generate.