Open Apelova opened 6 months ago
Thanks for reporting this and including a fix!
Note to self: make sure to also account for the case where there are many tabs or spaces.
P.S. I forgot to mention that I tested this fix against multiple arrangements of whitespace after and before the file name, and it seemed to fix all of them.
When trying to import a previously defined geometry using egs_glib quite a nerve wracking Bug occurs if there is a space before the line break.
I attached a simple Input-File for the usercode tutor7pp (and a geometry-file) that demonstrates the issue at hand (just comment/uncomment the lines 10 and 11 and make sure that sphere.geom is in the correct directory). It took me quite some time to realize what was happening when this bug first occurred, but after checking the source code, I recognized that the code only clears spaces in front of the file name to be imported.
The Bug can easily be fixed by inserting the line below in line 892 of egs_input.cpp
value = (*(value.end()-1) == ' ') ? string(value.begin(), value.end()-1) : value ;
Tutor7pp Input File
Geometry File
Operating system
EGSnrc version 2023