Can OGL viewer write output to relative directory?

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.

Hi Mike

Thanks for this. And sorry it’s taken so long to respond.

This is what I find:

/vis/ogl/set/printFilename ../exportTest/fileNameWithoutExtension
Format "/exportTest/fileNameWithoutExtension" is not available for the selected viewer. Current formats availables are : eps ps pdf svg bmp cur heic heif icns ico jp2 jpeg jpg pbm pgm png ppm tif tiff wbmp webp xbm xpm

This happens even if I have already specifically set the format with /vis/ogl/set/exportFormat, so something’s wrong and I/we will look into it…

But

/vis/ogl/set/printFilename …/exportTest/fileNameWithExtension.pdf
Changing export format to “pdf”
/vis/ogl/export
File …/exportTest/fileNameWithExtension_0000.pdf size: 1982x904 has been saved

John