diff options
author | scx <scx.mail@gmail.com> | 2020-03-15 15:02:50 +0100 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2020-03-15 15:02:50 +0100 |
commit | 799d74a247cc599c573121d93bc191c19c82a4ef (patch) | |
tree | d662afc0401138d5d50718c7c41cc1f9f985bb6a /glib | |
parent | f9d510c3262bee9f78d8a75fea6ad39a27a813e4 (diff) | |
download | glibmm-799d74a247cc599c573121d93bc191c19c82a4ef.tar.gz |
Add Glib::get_user_runtime_dir()
Wraps g_get_user_runtime_dir() from glib.
Returns a directory that is unique to the current user on the local system.
Closes GNOME/glibmm#57
Diffstat (limited to 'glib')
-rw-r--r-- | glib/src/miscutils.ccg | 6 | ||||
-rw-r--r-- | glib/src/miscutils.hg | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/glib/src/miscutils.ccg b/glib/src/miscutils.ccg index f11326d8..8ebc5956 100644 --- a/glib/src/miscutils.ccg +++ b/glib/src/miscutils.ccg @@ -182,6 +182,12 @@ get_user_cache_dir() return convert_const_gchar_ptr_to_stdstring(g_get_user_cache_dir()); } +std::string +get_user_runtime_dir() +{ + return convert_const_gchar_ptr_to_stdstring(g_get_user_runtime_dir()); +} + bool path_is_absolute(const std::string& filename) { diff --git a/glib/src/miscutils.hg b/glib/src/miscutils.hg index 75c3288f..8d379d58 100644 --- a/glib/src/miscutils.hg +++ b/glib/src/miscutils.hg @@ -287,6 +287,17 @@ std::vector<std::string> get_system_config_dirs(); GLIBMM_API std::string get_user_cache_dir(); +/** Returns a directory that is unique to the current user on the local system. + * + * This is the directory specified in the XDG_RUNTIME_DIR environment variable. + * In the case that this variable is not set, we return the value of + * Glib::get_user_cache_dir(), after verifying that it exists. + * + * @newin{2,64} + */ +GLIBMM_API +std::string get_user_runtime_dir(); + /** Returns @c true if the given @a filename is an absolute file name, i.e.\ it * contains a full path from the root directory such as <tt>"/usr/local"</tt> * on UNIX or <tt>"C:\\windows"</tt> on Windows systems. |