add --dev, --no-dev, --no-update flags

these will be replaced by #90 eventually
This commit is contained in:
Lion Kortlepel 2024-06-28 09:19:56 +02:00
parent 3535923f40
commit ba35d039ae
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -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