configuration: convert file paths from relative to absolute if necessary

This commit is contained in:
George Kiagiadakis 2020-11-26 20:09:07 +02:00
parent 55a6d20def
commit 630a6f5e1c

View file

@ -282,6 +282,7 @@ wp_configuration_reload (WpConfiguration *self, const char *extension)
GDir *conf_dir = NULL;
GError *error = NULL;
const gchar *file_name = NULL;
g_autofree gchar *cwd = g_get_current_dir ();
g_return_if_fail (WP_IS_CONFIGURATION (self));
@ -330,7 +331,10 @@ wp_configuration_reload (WpConfiguration *self, const char *extension)
while ((file_name = g_dir_read_name (conf_dir))) {
/* Only parse files that have the proper extension */
if (g_str_has_suffix (file_name, ext)) {
g_autofree gchar * location = g_build_filename (path, file_name, NULL);
g_autofree gchar * location =
g_path_is_absolute (path) ?
g_build_filename (path, file_name, NULL) :
g_build_filename (cwd, path, file_name, NULL);
wp_debug_object (self, "loading config file: %s", location);