diff --git a/src/power-profiles-daemon.c b/src/power-profiles-daemon.c index 8abc5dd..991c4d6 100644 --- a/src/power-profiles-daemon.c +++ b/src/power-profiles-daemon.c @@ -29,7 +29,7 @@ typedef struct { int ret; GKeyFile *config; - const char *config_path; + char *config_path; PpdProfile active_profile; PpdProfile selected_profile; @@ -284,9 +284,9 @@ load_configuration (PpdApp *data) g_autoptr(GError) error = NULL; if (g_getenv ("UMOCKDEV_DIR") != NULL) - data->config_path = "ppd_test_conf.ini"; + data->config_path = g_build_filename (g_getenv ("UMOCKDEV_DIR"), "ppd_test_conf.ini", NULL); else - data->config_path = "/var/lib/power-profiles-daemon/state.ini"; + data->config_path = g_strdup ("/var/lib/power-profiles-daemon/state.ini"); data->config = g_key_file_new (); if (!g_key_file_load_from_file (data->config, data->config_path, G_KEY_FILE_KEEP_COMMENTS, &error)) g_debug ("Could not load configuration file '%s': %s", data->config_path, error->message); @@ -894,6 +894,7 @@ free_app_data (PpdApp *data) data->name_id = 0; } + g_clear_pointer (&data->config_path, g_free); g_clear_pointer (&data->config, g_key_file_unref); g_ptr_array_free (data->probed_drivers, TRUE); g_ptr_array_free (data->actions, TRUE); diff --git a/tests/integration-test b/tests/integration-test index 16d1365..42ca21c 100755 --- a/tests/integration-test +++ b/tests/integration-test @@ -117,7 +117,7 @@ class Tests(dbusmock.DBusTestCase): self.stop_daemon() del self.tp_acpi try: - os.remove('ppd_test_conf.ini') + os.remove(self.testbed.get_root_dir() + '/' + 'ppd_test_conf.ini') except Exception: pass @@ -708,7 +708,7 @@ class Tests(dbusmock.DBusTestCase): self.stop_daemon() # sys.stderr.write('\n-------------- config file: ----------------\n') - # with open('ppd_test_conf.ini') as f: + # with open(self.testbed.get_root_dir() + '/' + 'ppd_test_conf.ini') as f: # sys.stderr.write(f.read()) # sys.stderr.write('------------------------------\n')