| @@ -24,13 +24,13 @@ | |||||
| #include <library.hpp> | #include <library.hpp> | ||||
| #include <network.hpp> | #include <network.hpp> | ||||
| #include <osdialog.h> | |||||
| #include <thread> | |||||
| #include <getopt.h> | |||||
| #include <unistd.h> // for getopt | #include <unistd.h> // for getopt | ||||
| #include <signal.h> // for signal | #include <signal.h> // for signal | ||||
| #if defined ARCH_WIN | #if defined ARCH_WIN | ||||
| #include <windows.h> // for CreateMutex | #include <windows.h> // for CreateMutex | ||||
| #endif | #endif | ||||
| #include <osdialog.h> | |||||
| #if defined ARCH_MAC | #if defined ARCH_MAC | ||||
| #define GLFW_EXPOSE_NATIVE_COCOA | #define GLFW_EXPOSE_NATIVE_COCOA | ||||
| @@ -73,9 +73,20 @@ int main(int argc, char* argv[]) { | |||||
| float screenshotZoom = 1.f; | float screenshotZoom = 1.f; | ||||
| // Parse command line arguments | // Parse command line arguments | ||||
| static const struct option longOptions[] = { | |||||
| {"safe", no_argument, NULL, 'a'}, | |||||
| {"dev", no_argument, NULL, 'd'}, | |||||
| {"headless", no_argument, NULL, 'h'}, | |||||
| {"screenshot", required_argument, NULL, 't'}, | |||||
| {"system", required_argument, NULL, 's'}, | |||||
| {"user", required_argument, NULL, 'u'}, | |||||
| {"version", no_argument, NULL, 'v'}, | |||||
| {NULL, 0, NULL, 0} | |||||
| }; | |||||
| int c; | int c; | ||||
| opterr = 0; | opterr = 0; | ||||
| while ((c = getopt(argc, argv, "adht:s:u:p:")) != -1) { | |||||
| while ((c = getopt_long(argc, argv, "adht:s:u:vp:", longOptions, NULL)) != -1) { | |||||
| switch (c) { | switch (c) { | ||||
| case 'a': { | case 'a': { | ||||
| settings::safeMode = true; | settings::safeMode = true; | ||||
| @@ -96,6 +107,10 @@ int main(int argc, char* argv[]) { | |||||
| case 'u': { | case 'u': { | ||||
| asset::userDir = optarg; | asset::userDir = optarg; | ||||
| } break; | } break; | ||||
| case 'v': { | |||||
| std::fprintf(stderr, "%s %s %s %s\n", APP_NAME.c_str(), APP_EDITION_NAME.c_str(), APP_VERSION.c_str(), APP_ARCH.c_str()); | |||||
| return 0; | |||||
| } | |||||
| // Mac "app translocation" passes a nonsense -psn_... flag, so -p is reserved. | // Mac "app translocation" passes a nonsense -psn_... flag, so -p is reserved. | ||||
| case 'p': break; | case 'p': break; | ||||
| default: break; | default: break; | ||||