| 1490 | |
| 1491 | #ifndef DORA_AS_LIB |
| 1492 | int CALLBACK WinMain( |
| 1493 | _In_ HINSTANCE hInstance, |
| 1494 | _In_ HINSTANCE hPrevInstance, |
| 1495 | _In_ LPSTR lpCmdLine, |
| 1496 | _In_ int nCmdShow) { |
| 1497 | #if DORA_WIN_CONSOLE |
| 1498 | SharedConsole.init(); |
| 1499 | #endif |
| 1500 | int argc = 0; |
| 1501 | LPWSTR* argvW = CommandLineToArgvW(GetCommandLineW(), &argc); |
| 1502 | std::vector<std::string> argvStorage; |
| 1503 | std::vector<char*> argv; |
| 1504 | if (argvW) { |
| 1505 | argvStorage.reserve(s_cast<size_t>(argc)); |
| 1506 | argv.reserve(s_cast<size_t>(argc)); |
| 1507 | for (int i = 0; i < argc; i++) { |
| 1508 | int len = WideCharToMultiByte(CP_UTF8, 0, argvW[i], -1, nullptr, 0, nullptr, nullptr); |
| 1509 | std::string item(s_cast<size_t>(len > 0 ? len - 1 : 0), '\0'); |
| 1510 | if (len > 0) { |
| 1511 | WideCharToMultiByte(CP_UTF8, 0, argvW[i], -1, item.data(), len, nullptr, nullptr); |
| 1512 | } |
| 1513 | argvStorage.push_back(std::move(item)); |
| 1514 | } |
| 1515 | LocalFree(argvW); |
| 1516 | for (auto& item : argvStorage) { |
| 1517 | argv.push_back(item.data()); |
| 1518 | } |
| 1519 | } |
| 1520 | if (!argv.empty() && Dora::isCliRequested(argc, argv.data())) { |
| 1521 | int exitCode = Dora::runCliApplication(argc, argv.data()); |
| 1522 | Dora::Life::destroy(Slice::Empty); |
| 1523 | return exitCode; |
| 1524 | } |
| 1525 | int exitCode = SharedApplication.run(); |
| 1526 | Dora::Life::destroy(Slice::Empty); |
| 1527 | return exitCode; |
| 1528 | } |
| 1529 | #endif // !DORA_AS_LIB |
| 1530 | |
| 1531 | #endif // BX_PLATFORM_WINDOWS |
nothing calls this directly
no test coverage detected