From a0909e9da2ed2fef6b1123fc5f704bddc3c9b252 Mon Sep 17 00:00:00 2001 From: kai Date: Tue, 22 Oct 2024 11:21:48 +0100 Subject: [PATCH] change GetSearchPathPrefix and GetSearchPath to NOT recurse up to mod --- modconfig/mod_tree_item_impl.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/modconfig/mod_tree_item_impl.go b/modconfig/mod_tree_item_impl.go index ac134642..ffb90bda 100644 --- a/modconfig/mod_tree_item_impl.go +++ b/modconfig/mod_tree_item_impl.go @@ -107,8 +107,12 @@ func (b *ModTreeItemImpl) GetSearchPath() []string { if len(b.SearchPath) != 0 { return b.SearchPath } + // if we have a parent, ask for its search path + // (stop when we get to the mod - the mod database property has lower precedence) if len(b.parents) > 0 { - return b.GetParents()[0].GetSearchPath() + if parent := b.GetParents()[0]; parent.BlockType() != schema.BlockTypeMod { + return parent.GetSearchPath() + } } return nil @@ -119,9 +123,14 @@ func (b *ModTreeItemImpl) GetSearchPathPrefix() []string { if len(b.SearchPathPrefix) != 0 { return b.SearchPathPrefix } - if len(b.GetParents()) > 0 { - return b.GetParents()[0].GetSearchPathPrefix() + // if we have a parent, ask for its search path prefix + // (stop when we get to the mod - the mod database property has lower precedence) + if len(b.parents) > 0 { + if parent := b.GetParents()[0]; parent.BlockType() != schema.BlockTypeMod { + return parent.GetSearchPath() + } } + return nil }