[libgweather/wip/hadess/fix-utc-sunrise] copy schemas files
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/wip/hadess/fix-utc-sunrise] copy schemas files
- Date: Mon, 8 Oct 2018 12:33:13 +0000 (UTC)
commit bd8d9e38fe86019bfdbec14f75c2cc64dd57aecb
Author: Bastien Nocera <hadess hadess net>
Date: Mon Oct 8 14:32:55 2018 +0200
copy schemas files
libgweather/test_libgweather.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/libgweather/test_libgweather.c b/libgweather/test_libgweather.c
index 5a05a53..8f20081 100644
--- a/libgweather/test_libgweather.c
+++ b/libgweather/test_libgweather.c
@@ -384,15 +384,31 @@ test_metar_weather_stations (void)
static void
set_gsettings (void)
{
- char *tmpdir, *schemadir, *cmdline;
+ char *tmpdir, *schema_text, *dest, *schemadir, *cmdline;
int result;
const char *orig_data_dirs;
+ /* Create the installed schemas directory */
tmpdir = g_strdup_printf ("libgweather-test-XXXXXX");
tmpdir = g_dir_make_tmp (tmpdir, NULL);
g_assert_nonnull (tmpdir);
schemadir = g_strdup_printf ("%s/glib-2.0/schemas", tmpdir);
g_assert_cmpint (g_mkdir_with_parents (schemadir, 0700), ==, 0);
+
+ /* Copy the schemas files */
+ g_assert (g_file_get_contents (SCHEMAS_BUILDDIR "/org.gnome.GWeather.enums.xml", &schema_text, NULL,
NULL));
+ dest = g_strdup_printf ("%s/org.gnome.GWeather.enums.xml", schemadir);
+ g_assert (g_file_set_contents (dest, schema_text, -1, NULL));
+ g_free (dest);
+ g_free (schema_text);
+
+ g_assert (g_file_get_contents (SCHEMASDIR "/org.gnome.GWeather.gschema.xml", &schema_text, NULL,
NULL));
+ dest = g_strdup_printf ("%s/org.gnome.GWeather.gschema.xml", schemadir);
+ g_assert (g_file_set_contents (dest, schema_text, -1, NULL));
+ g_free (dest);
+ g_free (schema_text);
+
+ /* Compile the schemas */
cmdline = g_strdup_printf ("glib-compile-schemas --targetdir=%s "
"--schema-file=%s/org.gnome.GWeather.enums.xml "
"--schema-file=%s/org.gnome.GWeather.gschema.xml",
@@ -402,6 +418,7 @@ set_gsettings (void)
g_assert (result == 0);
g_free (cmdline);
+ /* Modify XDG_DATA_DIRS */
orig_data_dirs = g_getenv ("XDG_DATA_DIRS");
if (!orig_data_dirs) {
g_setenv ("XDG_DATA_DIRS", tmpdir, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]