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() { CommandlineOptions* CommandlineOptions::getInstance() {
static CommandlineOptions commandlineOptions; static CommandlineOptions commandlineOptions;
return &commandlineOptions; return &commandlineOptions;

View file

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

View file

@ -230,8 +230,18 @@ void LauncherState::requestBuilds() {
request->send(_networkAccessManager); 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() { bool LauncherState::shouldDownloadLauncher() {
return _latestBuilds.launcherBuild.latestVersion != atoi(LAUNCHER_BUILD_VERSION); return _latestBuilds.launcherBuild.latestVersion != getBuildVersion().toInt();
} }
void LauncherState::getCurrentClientVersion() { void LauncherState::getCurrentClientVersion() {

View file

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

View file

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