Fix not printing issue

This commit is contained in:
offtkp 2024-09-25 17:08:48 +03:00
parent 87b8342b08
commit 51d21a274e
2 changed files with 10 additions and 9 deletions

View file

@ -6,6 +6,7 @@
#include <fmt/core.h>
#include <fmt/xchar.h> // for wstring support
#include <toml.hpp>
#include "common/logging/formatter.h"
#include "config.h"
namespace Config {
@ -449,15 +450,7 @@ void save(const std::filesystem::path& path) {
fmt::print("Filesystem error: {}\n", error.message());
}
try {
// Printing wstring (which a path is natively on Windows) to console is generally shaky.
// There's an open issue on fmtlib (#3491) where doing so can cause a crash, and it has
// happened to us too. We're going to assume the path can be converted to a string and
// printed safely, not printing the path if it can't.
fmt::print("Saving new configuration file {}\n", path.string());
} catch (...) {
fmt::print("Saving new configuration file\n");
}
fmt::print("Saving new configuration file {}\n", fmt::UTF(path.u8string()));
}
data["General"]["isPS4Pro"] = isNeo;

View file

@ -8,10 +8,18 @@
#include "game_install_dialog.h"
#include "main_window.h"
#ifdef _WIN32
#include <windows.h>
#endif
// Custom message handler to ignore Qt logs
void customMessageHandler(QtMsgType, const QMessageLogContext&, const QString&) {}
int main(int argc, char* argv[]) {
#ifdef _WIN32
SetConsoleOutputCP(CP_UTF8);
#endif
QApplication a(argc, argv);
// Load configurations and initialize Qt application