[glibmm/glibmm-2-64] Add Glib::get_user_runtime_dir()



commit 799d74a247cc599c573121d93bc191c19c82a4ef
Author: scx <scx mail gmail com>
Date:   Sun Mar 15 15:02:50 2020 +0100

    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

 glib/src/miscutils.ccg |  6 ++++++
 glib/src/miscutils.hg  | 11 +++++++++++
 2 files changed, 17 insertions(+)
---
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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]