mirror of
https://github.com/BeamMP/BeamMP-Launcher.git
synced 2026-02-16 02:30:44 +00:00
Support unicode in windows terminal
This commit is contained in:
@@ -57,36 +57,36 @@ void addToLog(const std::wstring& Line) {
|
|||||||
}
|
}
|
||||||
void info(const std::string& toPrint) {
|
void info(const std::string& toPrint) {
|
||||||
std::string Print = getDate() + "[INFO] " + toPrint + "\n";
|
std::string Print = getDate() + "[INFO] " + toPrint + "\n";
|
||||||
std::cout << Print;
|
std::wcout << Utils::ToWString(Print);
|
||||||
addToLog(Print);
|
addToLog(Print);
|
||||||
}
|
}
|
||||||
void debug(const std::string& toPrint) {
|
void debug(const std::string& toPrint) {
|
||||||
std::string Print = getDate() + "[DEBUG] " + toPrint + "\n";
|
std::string Print = getDate() + "[DEBUG] " + toPrint + "\n";
|
||||||
if (options.verbose) {
|
if (options.verbose) {
|
||||||
std::cout << Print;
|
std::wcout << Utils::ToWString(Print);
|
||||||
}
|
}
|
||||||
addToLog(Print);
|
addToLog(Print);
|
||||||
}
|
}
|
||||||
void warn(const std::string& toPrint) {
|
void warn(const std::string& toPrint) {
|
||||||
std::string Print = getDate() + "[WARN] " + toPrint + "\n";
|
std::string Print = getDate() + "[WARN] " + toPrint + "\n";
|
||||||
std::cout << Print;
|
std::wcout << Utils::ToWString(Print);
|
||||||
addToLog(Print);
|
addToLog(Print);
|
||||||
}
|
}
|
||||||
void error(const std::string& toPrint) {
|
void error(const std::string& toPrint) {
|
||||||
std::string Print = getDate() + "[ERROR] " + toPrint + "\n";
|
std::string Print = getDate() + "[ERROR] " + toPrint + "\n";
|
||||||
std::cout << Print;
|
std::wcout << Utils::ToWString(Print);
|
||||||
addToLog(Print);
|
addToLog(Print);
|
||||||
}
|
}
|
||||||
void fatal(const std::string& toPrint) {
|
void fatal(const std::string& toPrint) {
|
||||||
std::string Print = getDate() + "[FATAL] " + toPrint + "\n";
|
std::string Print = getDate() + "[FATAL] " + toPrint + "\n";
|
||||||
std::cout << Print;
|
std::wcout << Utils::ToWString(Print);
|
||||||
addToLog(Print);
|
addToLog(Print);
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(5));
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
||||||
std::exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
void except(const std::string& toPrint) {
|
void except(const std::string& toPrint) {
|
||||||
std::string Print = getDate() + "[EXCEP] " + toPrint + "\n";
|
std::string Print = getDate() + "[EXCEP] " + toPrint + "\n";
|
||||||
std::cout << Print;
|
std::wcout << Utils::ToWString(Print);
|
||||||
addToLog(Print);
|
addToLog(Print);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -269,6 +269,8 @@ void LinuxPatch() {
|
|||||||
|
|
||||||
void InitLauncher() {
|
void InitLauncher() {
|
||||||
SetConsoleTitleA(("BeamMP Launcher v" + std::string(GetVer()) + GetPatch()).c_str());
|
SetConsoleTitleA(("BeamMP Launcher v" + std::string(GetVer()) + GetPatch()).c_str());
|
||||||
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
|
_setmode(_fileno(stdout), _O_U8TEXT);
|
||||||
debug("Launcher Version : " + GetVer() + GetPatch());
|
debug("Launcher Version : " + GetVer() + GetPatch());
|
||||||
CheckName();
|
CheckName();
|
||||||
LinuxPatch();
|
LinuxPatch();
|
||||||
|
|||||||
Reference in New Issue
Block a user