mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-10-19 13:05:20 +00:00
chore: attach to console on windows if possible
This commit is contained in:
@@ -5,13 +5,16 @@
|
|||||||
#include "Web/ViteAssets.h"
|
#include "Web/ViteAssets.h"
|
||||||
#include "Web/WebViewLib.h"
|
#include "Web/WebViewLib.h"
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std::string_literals;
|
using namespace std::string_literals;
|
||||||
using namespace PLATFORM_NAMESPACE;
|
using namespace PLATFORM_NAMESPACE;
|
||||||
|
|
||||||
@@ -105,10 +108,23 @@ namespace
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int WINAPI WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/)
|
int WINAPI WinMain(HINSTANCE /*hInst*/, HINSTANCE /*hPrevInst*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/)
|
||||||
{
|
|
||||||
#else
|
#else
|
||||||
int main()
|
int main()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Attach console if possible on Windows for stdout/stderr in console
|
||||||
|
if (AttachConsole(-1))
|
||||||
|
{
|
||||||
|
FILE* fDummy;
|
||||||
|
(void)freopen_s(&fDummy, "CONOUT$", "w", stdout);
|
||||||
|
(void)freopen_s(&fDummy, "CONOUT$", "w", stderr);
|
||||||
|
(void)freopen_s(&fDummy, "CONIN$", "r", stdin);
|
||||||
|
std::cout.clear();
|
||||||
|
std::clog.clear();
|
||||||
|
std::cerr.clear();
|
||||||
|
std::cin.clear();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
con::info("Starting ModMan " GIT_VERSION);
|
con::info("Starting ModMan " GIT_VERSION);
|
||||||
|
Reference in New Issue
Block a user