portingtools/src/main.cpp

34 lines
887 B
C++
Raw Normal View History

2022-11-05 18:07:20 +01:00
#include "client.hpp"
#include "data.hpp"
#include "server.hpp"
2022-11-09 22:02:26 +01:00
2022-11-05 18:07:20 +01:00
#include <boost/log/trivial.hpp>
#include <cstring>
2022-11-07 01:01:36 +01:00
#include <stdexcept>
2022-11-05 18:07:20 +01:00
2022-11-09 22:02:26 +01:00
void main2(int argc, char* argv[]) {
if (argc < 2) {
throw std::runtime_error("not enough arguments!");
}
2022-11-05 18:07:20 +01:00
2022-11-09 22:02:26 +01:00
if (strcmp(argv[1], "serve") == 0) {
server::run(data::getIpcKeyFromExeName(argv[0]));
} else if (strcmp(argv[1], "map") == 0) {
client::map(data::getIpcKeyFromExeName(argv[0]));
} else if (strcmp(argv[1], "resourceloc") == 0) {
client::resolveResourceLoc(data::getIpcKeyFromExeName(argv[0]));
} else {
throw std::runtime_error("unknown command!");
}
2022-11-07 01:01:36 +01:00
}
2022-11-05 18:07:20 +01:00
2022-11-09 22:02:26 +01:00
int main(int argc, char* argv[]) {
try {
main2(argc, argv);
return 0;
} catch (const std::exception& e) {
BOOST_LOG_TRIVIAL(fatal) << "Exception: " << e.what();
return 1;
}
2022-11-05 18:07:20 +01:00
}