Stop mutating dirLocation while importing CAD files#157
Merged
maureeungaro merged 1 commit intoJun 13, 2026
Conversation
The STL import loop used dirLocation.append("/").append(cf), which
mutates dirLocation in place. After the first file, dirLocation was no
longer the directory path — the second iteration produced paths like
.../dir/a.stl/b.stl, so only the first STL resolved. The mangled value
also leaked to line 33, where the per-variation cad__<variation>.yaml
modifier path is built, so that override file was never found.
Use non-mutating concatenation (dirLocation + "/" + cf) so dirLocation
stays the directory path for every file and for the YAML lookup.
Fixes gemc#110
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The STL import loop used
dirLocation.append("/").append(cf), which mutatesdirLocationin place. After the first file,dirLocationwas no longer the directory path — the second iteration produced paths like.../dir/a.stl/b.stl, so only the first STL resolved. The mangled value also leaked to the next line, where the per-variationcad__<variation>.yamlmodifier path is built, so that override file was never found.Use non-mutating concatenation (
dirLocation + "/" + cf) sodirLocationstays the directory path for every file and for the YAML lookup.Validation: compiles clean (Geant4 11.4.1 dev container).
Fixes #110