]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbsupport: Use LOCALAPPDATA to determine cache dir
authorAlexander Fedotov <alfedotov@gmail.com>
Tue, 8 Dec 2020 10:07:23 +0000 (13:07 +0300)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 8 Dec 2020 14:50:12 +0000 (09:50 -0500)
Use the LOCALAPPDATA environment variable to determine the cache dir
when running on Windows with native command line, otherwise nasty
warning "Couldn't determine a path for index cached directory" appears.

Change-Id: I77903f9f0cb4743555866b8aea892cef55132589

gdbsupport/ChangeLog
gdbsupport/pathstuff.cc

index 88a0413e8b9fb98ddfb5635458346388565f27b9..417e44aff31dc5ccdad140dbad85991d6dd46834 100644 (file)
@@ -1,3 +1,8 @@
+2020-12-08  Alexander Fedotov  <alfedotov@gmail.com>
+
+       * pathstuff.cc (get_standard_cache_dir): Use LOCALAPPDATA environment
+       variable when running on Windows.
+
 2020-12-01  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * tdesc.cc (print_xml_feature::visit): Print enum fields using
index 311456720e4aa09cae5bc08d555026b2a8e2dd8a..b23e6ed064cfbbb2d2eac930eb910c61de23597f 100644 (file)
@@ -238,6 +238,16 @@ get_standard_cache_dir ()
       return string_printf ("%s/" HOME_CACHE_DIR "/gdb", abs.get ());
     }
 
+#ifdef WIN32
+  const char *win_home = getenv ("LOCALAPPDATA");
+  if (win_home != NULL)
+    {
+      /* Make sure the path is absolute and tilde-expanded.  */
+      gdb::unique_xmalloc_ptr<char> abs (gdb_abspath (win_home));
+      return string_printf ("%s/gdb", abs.get ());
+    }
+#endif
+    
   return {};
 }