From 2095c526b94a8e78690b964b609e9648690f24a9 Mon Sep 17 00:00:00 2001
From: Aleksandar Krauthaker <zebal@protonmail.ch>
Date: Mon, 30 Nov 2026 10:55:45 +0100
Subject: [PATCH] CLI: -debug option does not match filename as documented

Running unciv-server or a client with option -debug d:filename matches
filename as encountered by __FILE__ macro.

According to option help description and docs it should match filename as
substring without need to provide exact path or file extension.
This means if a portion of filename is given then all files matching the
substring will be considered.

Updated log_do_output_for_level_at_location to do case insensitive filename
substring match.

Signed-off-by: Aleksandar Krauthaker <zebal@protonmail.ch>
With-help-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
---
 utility/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utility/log.c b/utility/log.c
index d37dfcd348..c162d521cb 100644
--- a/utility/log.c
+++ b/utility/log.c
@@ -357,7 +357,7 @@ bool log_do_output_for_level_at_location(enum log_level level,
 
   for (i = 0, pfile = log_files; i < log_num_files; i++, pfile++) {
     if (pfile->level >= level
-        && 0 == strcmp(pfile->name, file)
+        && strcasestr(file, pfile->name) != NULL
         && ((0 == pfile->min && 0 == pfile->max)
             || (pfile->min <= line && pfile->max >= line))) {
       return TRUE;
-- 
2.47.3

