summaryrefslogtreecommitdiff
path: root/glib/gutilsprivate.h
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2018-11-30 17:47:18 +0000
committerPhilip Withnall <withnall@endlessm.com>2018-12-17 17:16:03 +0000
commit91defdb34eb71ff61d1d7fb2a518eda7d1824e42 (patch)
treebc5198f59107d78194f4ce75be3fc2e1b146a7ae /glib/gutilsprivate.h
parentb87dfb49605bf1e2ef54364ac1d894f8f1a77d3c (diff)
downloadglib-91defdb34eb71ff61d1d7fb2a518eda7d1824e42.tar.gz
gutils: Add internal API to override XDG directories
Add a new internal function, g_set_user_dirs(), which will safely override the values returned by g_get_user_data_dir() and friends, and the value returned by g_get_home_dir(). This is intended to be used by unit tests, and will be hooked up to them in a following commit. This can be called as many times as needed by the current process. It’s thread-safe. It does not modify the environment, so none of the changes are propagated to any subsequently spawned subprocesses. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/glib/issues/538
Diffstat (limited to 'glib/gutilsprivate.h')
-rw-r--r--glib/gutilsprivate.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/glib/gutilsprivate.h b/glib/gutilsprivate.h
new file mode 100644
index 000000000..5a0686086
--- /dev/null
+++ b/glib/gutilsprivate.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2018 Endless Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Philip Withnall <withnall@endlessm.com>
+ */
+
+#ifndef __G_UTILS_PRIVATE_H__
+#define __G_UTILS_PRIVATE_H__
+
+#include "gtypes.h"
+
+G_BEGIN_DECLS
+
+GLIB_AVAILABLE_IN_2_60
+void g_set_user_dirs (const gchar *first_dir_type,
+ ...) G_GNUC_NULL_TERMINATED;
+
+G_END_DECLS
+
+#endif /* __G_UTILS_PRIVATE_H__ */