setting some more testing env

This commit is contained in:
dante ruiz 2019-10-11 15:28:35 -07:00
parent e52d2ff342
commit 9f35a3b803
5 changed files with 28 additions and 2 deletions

View file

@ -26,6 +26,11 @@ void CommandlineOptions::parse(const int argc, char** argv) {
}
}
void CommandlineOptions::append(const std::string& command) {
qDebug() << "appending option: " << QString::fromStdString(command);
_commandlineOptions.push_back(command);
}
CommandlineOptions* CommandlineOptions::getInstance() {
static CommandlineOptions commandlineOptions;
return &commandlineOptions;

View file

@ -10,6 +10,7 @@ public:
void parse(const int argc, char** argv);
bool contains(const std::string& option);
void append(const std::string& command);
static CommandlineOptions* getInstance();
private:
std::vector<std::string> _commandlineOptions;

View file

@ -230,8 +230,18 @@ void LauncherState::requestBuilds() {
request->send(_networkAccessManager);
}
QString LauncherState::getBuildVersion() {
QString buildVersion { LAUNCHER_BUILD_VERSION };
QProcessEnvironment processEnvironment = QProcessEnvironment::systemEnvironment();
if (processEnvironment.contains("HQ_LAUNCHER_BUILD_VERSION")) {
buildVersion = processEnvironment.value("HQ_LAUNCHER_BUILD_VERSION");
}
return buildVersion;
}
bool LauncherState::shouldDownloadLauncher() {
return _latestBuilds.launcherBuild.latestVersion != atoi(LAUNCHER_BUILD_VERSION);
return _latestBuilds.launcherBuild.latestVersion != getBuildVersion().toInt();
}
void LauncherState::getCurrentClientVersion() {

View file

@ -94,7 +94,7 @@ public:
void setLastSignupErrorMessage(const QString& msg);
QString getLastSignupErrorMessage() const { return _lastSignupErrorMessage; }
QString getBuildVersion() { return QString(LAUNCHER_BUILD_VERSION); }
QString getBuildVersion();
QString getLastUsedUsername() const { return _lastUsedUsername; }
void setApplicationStateError(QString errorMessage);

View file

@ -7,6 +7,7 @@
#include "CommandlineOptions.h"
#include <iostream>
#include <string>
#include <QProcess>
#include "Helper.h"
#ifdef Q_OS_WIN
@ -36,6 +37,7 @@ int main(int argc, char *argv[]) {
Q_INIT_RESOURCE(resources);
cleanLogFile();
qInstallMessageHandler(messageHandler);
bool didUpdate = false;
#ifdef Q_OS_MAC
if (isLauncherAlreadyRunning()) {
return 0;
@ -44,6 +46,7 @@ int main(int argc, char *argv[]) {
if (argc == 3) {
if (hasSuffix(argv[1], "app") && hasSuffix(argv[2], "app")) {
swapLaunchers(argv[1], argv[2]);
didUpdate = true;
}
}
#endif
@ -64,6 +67,13 @@ int main(int argc, char *argv[]) {
}
#endif
QProcessEnvironment processEnvironment = QProcessEnvironment::systemEnvironment();
if (processEnvironment.contains("HQ_LAUNCHER_BUILD_VERSION")) {
if (didUpdate || options->contains("--restart")) {
options->append("--noUpdate");
}
}
Launcher launcher(argc, argv);
return launcher.exec();
}