Should I be able to save my visualization output to a directory relative to my PWD? Specifically, I tried using the command
/vis/ogl/set/printFilename ../test_repo/Ba133_soudan_cryo
and got back the error
Format "/test_repo/Ba133_soudan_cryo" is not available for the selected viewer.
Current formats availables are : eps ps pdf svg
The printing itself worked, but I got the file G4OpenGL_viewer-0_0000.eps in my current directory, rather than what I desired.
It appears as though the printFilename
action is treating the period unconditionally as a filename/filetype delimiter, without recognizing that the ‘.’ appears as part of a directory path. I suspect the same thing would happen with any directory name containing a dot (e.g., a name like “beams/12.5keV/XRF_test” would result in the incorrect “format” 5keV/XRF_test).
Making a call to realpath()
in the G4 code before trying to extract the file type would work for the relative-path case, but would fail if a directory name actually contained a dot (as in my second example above).
There’s no general fix for this with C++11 (Boost provides filename-aware classes, but G4 does not, and should not, depend on Boost). C++17 has adopted some (all?) of boost into STL, but G4 is not yet requiring C++17, as far as I know.