with the --write-to-source-file-directory added to allow one to have the original behaviour
of writing to the same directory as the original source file.
osg2cpp application to me today. The conversion result may become
incorrect if there are quotation marks ( " ) in the shader file, which
will mostly appear in comment lines.
Replace all " into \" before writing to cpp files will solve the
problem, as the attached file shows."
Currently osg2cpp removes "\n" line endings to replace them with a textual equivalent ("\\n") in order for the string representing the shader to contain line endings in the string. But if the file that was read contained Windows line endings ("\r\n"), the resulting file looked really weird (the \r were left there and editors interpreted that as an additional newline). Also, I can imagine that if the shader file that was read had Mac line endings ("\r") then the output shader would all end up in one long line since there are no "\n"...
What I've done:
I've added a search and replace of "\r\n" to "\n", and then "\r" to "\n" (note that the order is important).
I've also changed the filename handling so that the output file will be put in the same directory as the input file in case it was specified with a path. Previous functionality is retained for files specified with the filename only.""