aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/pathstuff.cc
diff options
context:
space:
mode:
authorAlexander Fedotov <alfedotov@gmail.com>2020-12-08 13:07:23 +0300
committerSimon Marchi <simon.marchi@polymtl.ca>2020-12-08 09:50:12 -0500
commit60a7223fdd196d540f87504833166f558c95c035 (patch)
tree7effd01923f0d141b2a9db352c03577e4eba1580 /gdbsupport/pathstuff.cc
parentb46551b20c9617e0cf2fda9a32b2132f3a7fd35c (diff)
downloadbinutils-60a7223fdd196d540f87504833166f558c95c035.zip
binutils-60a7223fdd196d540f87504833166f558c95c035.tar.gz
binutils-60a7223fdd196d540f87504833166f558c95c035.tar.bz2
gdbsupport: Use LOCALAPPDATA to determine cache dir
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
Diffstat (limited to 'gdbsupport/pathstuff.cc')
-rw-r--r--gdbsupport/pathstuff.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc
index 3114567..b23e6ed 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<char> abs (gdb_abspath (win_home));
+ return string_printf ("%s/gdb", abs.get ());
+ }
+#endif
+
return {};
}