MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/RTXGI-DDGI / ParseCommandLine

Function ParseCommandLine

samples/test-harness/src/Config.cpp:540–568  ·  view source on GitHub ↗

* Parse the command line to get the configuration file path. */

Source from the content-addressed store, hash-verified

538* Parse the command line to get the configuration file path.
539*/
540bool ParseCommandLine(LPWSTR lpCmdLine, ConfigInfo &config, std::ofstream &log)
541{
542 if (__argc <= 1)
543 {
544 // There is one argument (or less) - just the executable path
545 // Exit since a configuration file is not specified
546 log << "Error: a configuration file must be specified!\n";
547 return false;
548 }
549
550 if (__argc > 2)
551 {
552 // There are more than two arguments (executable + configuration file)
553 // Exit since there must be a single argument after the executable path
554 log << "Error: incorrect command line usage! A single argument (the configuration file) must be specified.\n";
555 return false;
556 }
557
558 size_t len;
559 size_t max = wcslen(__wargv[1]) + 1;
560 char* dst = new char[max];
561
562 wcstombs_s(&len, dst, max, __wargv[1], max);
563 config.filepath = std::string(dst);
564
565 delete[] dst;
566
567 return true;
568}
569
570}

Callers 1

RunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected