vsg-dev / vsgXchange

Utility library for converting data+materials to/from VulkanSceneGraph
MIT License
65 stars 39 forks source link

vsgconv does not properly handle a missing 'output_filefilename' argument #158

Closed appcodegen closed 1 year ago

appcodegen commented 1 year ago

Calling vsgconv like this 'vsgconv input_filename' will result in the program simply emitting the 'No files loaded.' message to stdout, with a return code of 1 (I suppose that means 'error' but that's probably something for a different issue).

Internally, 'input_filename' is actually being read into the 'outputFilename' (arguments[argc - 1]) variable, with the actual input filenames never being parsed (so from that point of view the 'No files loaded' message is correct).

I think there's an additional argc check (for it being > 2) being called for, just before the input files are being parsed. If that check fails the program should emit an appropriate error message and quit, rather than letting the user scratch his head (I know I did, thinking that my ReaderWriter could not handle my inputfile, a situation which I encountered earlier).

I see that there's some code to optionally remove the outputFilename file (line 363), which maybe could be used to replace the inputfile with the outputfile (but that would mean that both input and output are already in a VSG format, which would not make any sense?), and I also don't see how that option could actually be specified so I don't think this use case needs to be accounted for (and if it was, then a change would be required to actually enable reading that file using the ReaderWriter, which is currently being skipped if argc <= 2.