aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/pathstuff.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-07-05 13:02:40 -0600
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-11-02 17:42:10 +0000
commit8768c3e3629657d9728487c680b173868baeee7f (patch)
tree9a8e29f261a25438a33f59a5950d499b6ecfb718 /gdbsupport/pathstuff.h
parent5b3d3560e9e867f652ff622863cbac267455f726 (diff)
downloadbinutils-8768c3e3629657d9728487c680b173868baeee7f.zip
binutils-8768c3e3629657d9728487c680b173868baeee7f.tar.gz
binutils-8768c3e3629657d9728487c680b173868baeee7f.tar.bz2
Add get_standard_config_dir function
This adds a new get_standard_config_dir, which returns the name of the configuration directory. In XDG, this is ~/.config/gdb/. Future patches will make use of this. 2020-07-05 Tom Tromey <tom@tromey.com> * pathstuff.h (get_standard_config_dir): Declare. * pathstuff.cc (get_standard_config_dir): New function.
Diffstat (limited to 'gdbsupport/pathstuff.h')
-rw-r--r--gdbsupport/pathstuff.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h
index 4bc0d89..85241bc 100644
--- a/gdbsupport/pathstuff.h
+++ b/gdbsupport/pathstuff.h
@@ -85,6 +85,20 @@ extern std::string get_standard_cache_dir ();
extern std::string get_standard_temp_dir ();
+/* Get the usual user config directory for the current platform.
+
+ On Linux, it follows the XDG Base Directory specification: use
+ $XDG_CONFIG_HOME/gdb if the XDG_CONFIG_HOME environment variable is
+ defined, otherwise $HOME/.config.
+
+ On macOS, it follows the local convention and uses
+ ~/Library/Preferences/gdb.
+
+ The return value is absolute and tilde-expanded. Return an empty
+ string if neither XDG_CONFIG_HOME (on Linux) or HOME are defined. */
+
+extern std::string get_standard_config_dir ();
+
/* Return the file name of the user's shell. Normally this comes from
the SHELL environment variable. */