From 98f12cf041602bde85ac16a06aff2876144632d6 Mon Sep 17 00:00:00 2001 From: Brigs Date: Mon, 6 Jul 2026 18:04:24 -0400 Subject: [PATCH] get_relative_path: shorten data_folder everywhere it appears The relative-source-paths fix shortened the returned source_path per newline segment, but artifacts that join multiple absolute paths with other separators (', ', '; ', ' ') only had the first path shortened: startswith matches the head of the concatenated string, strips one prefix, and the rest stayed absolute. Spotted by James Habben. Replace the startswith branch with a global replacement of the data_folder prefix, so every embedded occurrence is shortened regardless of separator. All previous behaviors are preserved (exact path, literal passthrough, already-relative, no data_folder) and covered by tests. --- scripts/context.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/context.py b/scripts/context.py index 273b75a0..09037382 100644 --- a/scripts/context.py +++ b/scripts/context.py @@ -361,9 +361,14 @@ def get_relative_path(full_path): if not full_path or not Context._data_folder: return full_path - if full_path.startswith(Context._data_folder): - # Strip the base path and any leading separators - return full_path[len(Context._data_folder):].lstrip('/\\') + if Context._data_folder in full_path: + # Strip the base path everywhere it appears, including inside path + # strings concatenated with arbitrary separators (', ', '; ', ...) + base = Context._data_folder + return (full_path.replace(base + '/', '') + .replace(base + '\\', '') + .replace(base, '') + .lstrip('/\\')) return full_path