[gnome-software/wip/hughsie/libxmlb: 8/15] trivial: Allow self tests to override the chosen cachedir
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/libxmlb: 8/15] trivial: Allow self tests to override the chosen cachedir
- Date: Thu, 18 Oct 2018 15:59:03 +0000 (UTC)
commit 08db3d04e8c5be1ac52c5401d9924da2c2fbbb97
Author: Richard Hughes <richard hughsie com>
Date: Mon Oct 15 12:25:29 2018 +0100
trivial: Allow self tests to override the chosen cachedir
lib/gs-utils.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/lib/gs-utils.c b/lib/gs-utils.c
index 23d24995e..dbb7c1ccb 100644
--- a/lib/gs-utils.c
+++ b/lib/gs-utils.c
@@ -165,11 +165,17 @@ gs_utils_get_cache_filename (const gchar *kind,
GsUtilsCacheFlags flags,
GError **error)
{
+ const gchar *tmp;
g_autofree gchar *basename = NULL;
g_autofree gchar *cachedir = NULL;
g_autoptr(GFile) cachedir_file = NULL;
g_autoptr(GPtrArray) candidates = g_ptr_array_new_with_free_func (g_free);
+ /* in the self tests */
+ tmp = g_getenv ("GS_SELF_TEST_CACHEDIR");
+ if (tmp != NULL)
+ return g_build_filename (tmp, kind, resource, NULL);
+
/* get basename */
if (flags & GS_UTILS_CACHE_FLAG_USE_HASH) {
g_autofree gchar *basename_tmp = g_path_get_basename (resource);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]