| 56 | } |
| 57 | |
| 58 | std::vector<std::string> GetCommandLineArguments() |
| 59 | { |
| 60 | int argc; |
| 61 | auto argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
| 62 | |
| 63 | std::vector<std::string> arguments{}; |
| 64 | arguments.reserve(argc); |
| 65 | |
| 66 | for (int idx = 1; idx < argc; idx++) |
| 67 | { |
| 68 | std::wstring hstr{argv[idx]}; |
| 69 | int bytesRequired = ::WideCharToMultiByte(CP_UTF8, 0, &hstr[0], static_cast<int>(hstr.size()), nullptr, 0, nullptr, nullptr); |
| 70 | arguments.push_back(std::string(bytesRequired, 0)); |
| 71 | ::WideCharToMultiByte(CP_UTF8, 0, hstr.data(), static_cast<int>(hstr.size()), arguments.back().data(), bytesRequired, nullptr, nullptr); |
| 72 | } |
| 73 | |
| 74 | LocalFree(argv); |
| 75 | |
| 76 | return arguments; |
| 77 | } |
| 78 | |
| 79 | void Uninitialize() |
| 80 | { |