From 4b54cc4dacc502a583d864e49faf122272746a09 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 27 Nov 2013 20:12:05 -0800 Subject: Handle relative path in XDG_CONFIG_HOME Playing with XDG_CONFIG_HOME in the previous commit showed that one test failed if it was a relative path. Luckily that is a bug in the test and not in the code. [endlessm/eos-sdk#357] --- test/test-application.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test-application.c b/test/test-application.c index 065f3f8..75165d4 100644 --- a/test/test-application.c +++ b/test/test-application.c @@ -76,6 +76,8 @@ test_config_dir_returns_expected_path (ConfigDirFixture *fixture, gconstpointer unused) { GFile *config_dir = eos_application_get_config_dir (fixture->app); + /* XDG_CONFIG_HOME may be a relative path, so resolve it via file handles */ + GFile *xdg_user_config_dir = g_file_new_for_path (g_get_user_config_dir ()); char *basename = g_file_get_basename (config_dir); g_assert_cmpstr (basename, ==, fixture->unique_id); @@ -84,8 +86,13 @@ test_config_dir_returns_expected_path (ConfigDirFixture *fixture, GFile *parent = g_file_get_parent (config_dir); char *dirname = g_file_get_path (parent); g_object_unref (parent); - g_assert_cmpstr (dirname, ==, g_get_user_config_dir ()); + + char *xdg_dirname = g_file_get_path (xdg_user_config_dir); + g_object_unref (xdg_user_config_dir); + + g_assert_cmpstr (dirname, ==, xdg_dirname); g_free (dirname); + g_free (xdg_dirname); } static void -- cgit v1.2.3