[glibmm: 1/2] Add Glib::get_user_runtime_dir()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm: 1/2] Add Glib::get_user_runtime_dir()
- Date: Thu, 26 Sep 2019 12:42:07 +0000 (UTC)
commit 2b5e4974bbe0765666047be5b0795dd21ccf9c23
Author: scx <scx mail gmail com>
Date: Sun Sep 22 22:25:18 2019 +0200
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 | 9 +++++++++
2 files changed, 15 insertions(+)
---
diff --git a/glib/src/miscutils.ccg b/glib/src/miscutils.ccg
index 90043aff..e0616310 100644
--- a/glib/src/miscutils.ccg
+++ b/glib/src/miscutils.ccg
@@ -146,6 +146,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 ffc87f31..d1748cfe 100644
--- a/glib/src/miscutils.hg
+++ b/glib/src/miscutils.hg
@@ -244,6 +244,15 @@ std::vector<std::string> get_system_config_dirs();
*/
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 g_get_user_cache_dir(), after verifying
that it exists.
+ *
+ * @newin{2,64}
+ */
+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]