Skip to content

Commit

Permalink
change GetSearchPathPrefix and GetSearchPath to NOT recurse up to mod
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidaguerre committed Oct 22, 2024
1 parent 5d01e18 commit a0909e9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions modconfig/mod_tree_item_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit a0909e9

Please sign in to comment.