Changed the default directory for the output files to be the current working directory,
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.
This commit is contained in:
parent
8a0e49d780
commit
b41e5ccc77
@ -69,6 +69,7 @@ int main( int argc, char **argv )
|
||||
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting glsl shader files into char arrays that can be compiled into applications.");
|
||||
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--write-to-source-file-directory","Use the path to the source filename as the directory to write to.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
|
||||
|
||||
// if user request help write it out to cout.
|
||||
@ -78,6 +79,9 @@ int main( int argc, char **argv )
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool useSamePathAsSourceFile = false;
|
||||
if (arguments.read("--write-to-source-file-directory")) useSamePathAsSourceFile = true;
|
||||
|
||||
std::string filename;
|
||||
if (arguments.read("--shader",filename))
|
||||
{
|
||||
@ -96,7 +100,9 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
std::string ext = osgDB::getFileExtension(filename);
|
||||
std::string cppFileName = osgDB::concatPaths(path, name + "_" + ext + ".cpp");
|
||||
std::string cppFileName = name + "_" + ext + ".cpp";
|
||||
if (useSamePathAsSourceFile) cppFileName = osgDB::concatPaths(path, cppFileName);
|
||||
|
||||
std::string variableName = name + "_" + ext;
|
||||
writeShader(shader.get(), cppFileName, variableName);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user