conf: explain behaviour of wp_base_dirs_find_file

The signature of the function is quite misleading. If an absolute
path is passed to it, it will ignore the directory constraint flags
and search outside of the specified directories anyway. Make a note
of this in its caller.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
This commit is contained in:
James Calligeros
2024-03-30 14:18:49 +10:00
parent 8892204f24
commit 105d53025e

View File

@@ -269,10 +269,13 @@ wp_conf_open (WpConf * self, GError ** error)
g_autoptr (WpIterator) iterator = NULL;
g_auto (GValue) value = G_VALUE_INIT;
/* open the main file */
/*
* open the config file - if the path supplied is absolute,
* wp_base_dirs_find_file will ignore WP_BASE_DIRS_CONFIGURATION
*/
path = wp_base_dirs_find_file (WP_BASE_DIRS_CONFIGURATION, NULL, self->name);
if (path) {
wp_info_object (self, "opening main file: %s", path);
wp_info_object (self, "opening config file: %s", path);
if (!open_and_load_sections (self, path, error))
return FALSE;
}