From 2e4a83547dab84722854aecbc35ee76f70a5c464 Mon Sep 17 00:00:00 2001 From: XMRig Date: Tue, 24 Dec 2019 02:04:34 +0700 Subject: [PATCH] Add console title for Windows. --- src/base/io/log/backends/ConsoleLog.cpp | 11 +++++++---- src/base/io/log/backends/ConsoleLog.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/base/io/log/backends/ConsoleLog.cpp b/src/base/io/log/backends/ConsoleLog.cpp index 4d3c532a0..bf17deb7b 100644 --- a/src/base/io/log/backends/ConsoleLog.cpp +++ b/src/base/io/log/backends/ConsoleLog.cpp @@ -27,9 +27,10 @@ #include -#include "base/tools/Handle.h" #include "base/io/log/backends/ConsoleLog.h" +#include "base/tools/Handle.h" #include "base/io/log/Log.h" +#include "version.h" xmrig::ConsoleLog::ConsoleLog() @@ -48,7 +49,7 @@ xmrig::ConsoleLog::ConsoleLog() uv_tty_set_mode(m_tty, UV_TTY_MODE_NORMAL); -# ifdef WIN32 +# ifdef XMRIG_OS_WIN m_stream = reinterpret_cast(m_tty); HANDLE handle = GetStdHandle(STD_INPUT_HANDLE); @@ -59,6 +60,8 @@ xmrig::ConsoleLog::ConsoleLog() SetConsoleMode(handle, mode | ENABLE_EXTENDED_FLAGS); } } + + SetConsoleTitleA(APP_NAME " " APP_VERSION); # endif } @@ -75,7 +78,7 @@ void xmrig::ConsoleLog::print(int, const char *line, size_t, size_t size, bool c return; } -# ifdef _WIN32 +# ifdef XMRIG_OS_WIN uv_buf_t buf = uv_buf_init(const_cast(line), static_cast(size)); if (!isWritable()) { @@ -99,7 +102,7 @@ bool xmrig::ConsoleLog::isSupported() const } -#ifdef WIN32 +#ifdef XMRIG_OS_WIN bool xmrig::ConsoleLog::isWritable() const { if (!m_stream || uv_is_writable(m_stream) != 1) { diff --git a/src/base/io/log/backends/ConsoleLog.h b/src/base/io/log/backends/ConsoleLog.h index 549243ad9..89ed36041 100644 --- a/src/base/io/log/backends/ConsoleLog.h +++ b/src/base/io/log/backends/ConsoleLog.h @@ -54,7 +54,7 @@ private: uv_tty_t *m_tty = nullptr; -# ifdef _WIN32 +# ifdef XMRIG_OS_WIN bool isWritable() const; uv_stream_t *m_stream = nullptr;