| 22 | } |
| 23 | |
| 24 | std::vector<std::string> GetCommandLineArguments() { |
| 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. |
| 26 | int argc; |
| 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); |
| 28 | if (argv == nullptr) { |
| 29 | return std::vector<std::string>(); |
| 30 | } |
| 31 | |
| 32 | std::vector<std::string> command_line_arguments; |
| 33 | |
| 34 | // Skip the first argument as it's the binary name. |
| 35 | for (int i = 1; i < argc; i++) { |
| 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); |
| 37 | } |
| 38 | |
| 39 | ::LocalFree(argv); |
| 40 | |
| 41 | return command_line_arguments; |
| 42 | } |
| 43 | |
| 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { |
| 45 | if (utf16_string == nullptr) { |
no test coverage detected