From ba35d039ae9d7cfe19b7d581572ec8c27e5c413e Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Fri, 28 Jun 2024 09:19:56 +0200 Subject: [PATCH] add --dev, --no-dev, --no-update flags these will be replaced by #90 eventually --- src/Startup.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Startup.cpp b/src/Startup.cpp index f6f519a..b527ce1 100644 --- a/src/Startup.cpp +++ b/src/Startup.cpp @@ -172,7 +172,7 @@ void CheckForUpdates(int argc, char* args[], const std::string& CV) { system("clear"); #endif - if (FileHash != LatestHash && IsOutdated(Version(VersionStrToInts(GetVer() + GetPatch())), Version(VersionStrToInts(LatestVersion))) && !Dev) { + if (FileHash != LatestHash && IsOutdated(Version(VersionStrToInts(GetVer() + GetPatch())), Version(VersionStrToInts(LatestVersion)))) { info("Launcher update found!"); #if defined(__linux__) error("Auto update is NOT implemented for the Linux version. Please update manually ASAP as updates contain security patches."); @@ -204,6 +204,13 @@ void CustomPort(int argc, char* argv[]) { if (argc > 2) Dev = true; } + for (int i = 1; i < argc; ++i) { + if (std::string_view(argv[i]) == "--dev") { + Dev = true; + } else if (std::string_view(argv[i]) == "--no-dev") { + Dev = false; + } + } } #ifdef _WIN32 @@ -255,7 +262,15 @@ void InitLauncher(int argc, char* argv[]) { CheckLocalKey(); ConfigInit(); CustomPort(argc, argv); - CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch()); + bool update = true; + for (int i = 1; i < argc; ++i) { + if (std::string_view(argv[i]) == "--no-update") { + update = false; + } + } + if (update) { + CheckForUpdates(argc, argv, std::string(GetVer()) + GetPatch()); + } } #endif