Add DWARF index cache
[deliverable/binutils-gdb.git] / gdb / common / pathstuff.c
index 8c4093fc38de69a614621ae78b8e01a1f86e9c8c..2d9dcb25d40f08fedf4de7b090b28ea14f89ff7d 100644 (file)
@@ -158,3 +158,27 @@ contains_dir_separator (const char *path)
 
   return false;
 }
+
+/* See common/pathstuff.h.  */
+
+std::string
+get_standard_cache_dir ()
+{
+  char *xdg_cache_home = getenv ("XDG_CACHE_HOME");
+  if (xdg_cache_home != NULL)
+    {
+      /* Make sure the path is absolute and tilde-expanded.  */
+      gdb::unique_xmalloc_ptr<char> abs (gdb_abspath (xdg_cache_home));
+      return string_printf ("%s/gdb", abs.get ());
+    }
+
+  char *home = getenv ("HOME");
+  if (home != NULL)
+    {
+      /* Make sure the path is absolute and tilde-expanded.  */
+      gdb::unique_xmalloc_ptr<char> abs (gdb_abspath (home));
+      return string_printf ("%s/.cache/gdb", abs.get ());
+    }
+
+  return {};
+}
This page took 0.024491 seconds and 4 git commands to generate.