diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog index 88a0413e8b..417e44aff3 100644 --- a/gdbsupport/ChangeLog +++ b/gdbsupport/ChangeLog @@ -1,3 +1,8 @@ +2020-12-08 Alexander Fedotov + + * pathstuff.cc (get_standard_cache_dir): Use LOCALAPPDATA environment + variable when running on Windows. + 2020-12-01 Andrew Burgess * tdesc.cc (print_xml_feature::visit): Print enum fields using diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc index 311456720e..b23e6ed064 100644 --- a/gdbsupport/pathstuff.cc +++ b/gdbsupport/pathstuff.cc @@ -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 abs (gdb_abspath (win_home)); + return string_printf ("%s/gdb", abs.get ()); + } +#endif + return {}; }