Files
frelay/Console/main.cpp

41 lines
937 B
C++
Raw Normal View History

2025-06-17 12:00:46 +08:00
#include <QCoreApplication>
2025-06-20 10:33:03 +08:00
#include <Util.h>
2025-06-17 12:00:46 +08:00
#include "Console.h"
#ifndef COMPILER_USE_MINGW
#include <crashelper.h>
#endif
2025-06-17 12:00:46 +08:00
int main(int argc, char* argv[])
{
2025-06-20 17:21:58 +08:00
if (argc < 3) {
std::cerr << "Usage arg is ip port." << std::endl;
return 0;
}
#ifndef COMPILER_USE_MINGW
2025-06-20 10:33:03 +08:00
auto configDir = Util::GetCurConfigPath("frelay");
#ifdef _WIN32
backward::SetDumpFileSavePath(configDir + "/dumpfile");
backward::SetDumpLogSavePath(configDir + "/dumplog");
#else
2025-06-21 12:08:01 +08:00
backward::SetDumpLogSavePath(configDir + "/dumplog");
2025-06-20 10:33:03 +08:00
#endif
#endif
2025-06-17 12:00:46 +08:00
QCoreApplication app(argc, argv);
Util::InitLogger("frelayConsole.log", "frelayConsole");
qInstallMessageHandler(Util::ConsoleMsgHander);
2025-06-20 17:21:58 +08:00
auto* core = new ClientCore();
auto* helper = new ConsoleHelper();
helper->SetIpPort(argv[1], QString("%1").arg(argv[2]).toInt());
helper->RunWorker(core);
helper->Connect();
2025-06-17 12:00:46 +08:00
return app.exec();
2025-06-21 12:08:01 +08:00
}