2022-11-05 18:07:20 +01:00
|
|
|
#include "client.hpp"
|
|
|
|
#include "data.hpp"
|
|
|
|
#include "server.hpp"
|
|
|
|
#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-07 01:01:36 +01:00
|
|
|
void main2(int argc, char *argv[]) {
|
2022-11-05 18:07:20 +01:00
|
|
|
if (argc < 2) {
|
2022-11-07 01:01:36 +01:00
|
|
|
throw std::runtime_error("not enough arguments!");
|
2022-11-05 18:07:20 +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 {
|
2022-11-07 01:01:36 +01:00
|
|
|
throw std::runtime_error("unknown command!");
|
2022-11-05 18:07:20 +01:00
|
|
|
}
|
2022-11-07 01:01:36 +01:00
|
|
|
}
|
2022-11-05 18:07:20 +01:00
|
|
|
|
2022-11-07 01:01:36 +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
|
|
|
}
|