portingtools/src/main.cpp

34 lines
887 B
C++

#include "client.hpp"
#include "data.hpp"
#include "server.hpp"
#include <boost/log/trivial.hpp>
#include <cstring>
#include <stdexcept>
void main2(int argc, char* argv[]) {
if (argc < 2) {
throw std::runtime_error("not enough arguments!");
}
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!");
}
}
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;
}
}