Blob Blame History Raw
From 105d53025e1d877ed046a062f823c35ea934af2a Mon Sep 17 00:00:00 2001
From: James Calligeros <jcalligeros99@gmail.com>
Date: Sat, 30 Mar 2024 14:18:49 +1000
Subject: [PATCH 02/10] 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>
---
 lib/wp/conf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/wp/conf.c b/lib/wp/conf.c
index 4638f57e..f10a04cc 100644
--- a/lib/wp/conf.c
+++ b/lib/wp/conf.c
@@ -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;
   }
-- 
2.44.0