| 81 | } |
| 82 | |
| 83 | WindowsPlatformContext::WindowsPlatformContext(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow) : |
| 84 | PlatformContext{} |
| 85 | { |
| 86 | _external_storage_directory = ""; |
| 87 | _temp_directory = get_temp_path_from_environment(); |
| 88 | _arguments = get_args(); |
| 89 | |
| 90 | // Attempt to attach to the parent process console if it exists |
| 91 | if (!AttachConsole(ATTACH_PARENT_PROCESS)) |
| 92 | { |
| 93 | // No parent console, allocate a new one for this process |
| 94 | if (!AllocConsole()) |
| 95 | { |
| 96 | throw std::runtime_error{"AllocConsole error"}; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | FILE *fp; |
| 101 | freopen_s(&fp, "conin$", "r", stdin); |
| 102 | freopen_s(&fp, "conout$", "w", stdout); |
| 103 | freopen_s(&fp, "conout$", "w", stderr); |
| 104 | } |
| 105 | } // namespace vkb |
nothing calls this directly
no test coverage detected