mirror of
https://github.com/overte-org/overte.git
synced 2025-07-28 21:10:24 +02:00
Can run installer, but does not wait for completion.
This commit is contained in:
parent
82d9fa6859
commit
6b83d98788
2 changed files with 38 additions and 13 deletions
|
@ -19,6 +19,12 @@ TestRunner::TestRunner(QObject *parent) : QObject(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::run() {
|
void TestRunner::run() {
|
||||||
|
selectTemporaryFolder();
|
||||||
|
runInstaller();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
saveExistingHighFidelityAppDataFolder();
|
saveExistingHighFidelityAppDataFolder();
|
||||||
selectTemporaryFolder();
|
selectTemporaryFolder();
|
||||||
|
|
||||||
|
@ -26,7 +32,7 @@ void TestRunner::run() {
|
||||||
urls << "http://builds.highfidelity.com/HighFidelity-Beta-latest-dev.exe";
|
urls << "http://builds.highfidelity.com/HighFidelity-Beta-latest-dev.exe";
|
||||||
|
|
||||||
QStringList filenames;
|
QStringList filenames;
|
||||||
filenames << "HighFidelity-Beta-latest-dev.exe";
|
filenames << _installerFilename;
|
||||||
|
|
||||||
autoTester->downloadFiles(urls, _tempDirectory, filenames, (void *)this);
|
autoTester->downloadFiles(urls, _tempDirectory, filenames, (void *)this);
|
||||||
|
|
||||||
|
@ -34,9 +40,21 @@ void TestRunner::run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::installerDownloadComplete() {
|
void TestRunner::installerDownloadComplete() {
|
||||||
|
runInstaller();
|
||||||
|
|
||||||
restoreHighFidelityAppDataFolder();
|
restoreHighFidelityAppDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestRunner::runInstaller() {
|
||||||
|
QProcess installProcess;
|
||||||
|
|
||||||
|
QStringList arguments{ QStringList() << QString("/S") << QString("/D=") + QDir::toNativeSeparators(_tempDirectory) };
|
||||||
|
|
||||||
|
QString installerFullPath = _tempDirectory + "/" + _installerFilename;
|
||||||
|
qint64 pid;
|
||||||
|
QProcess::startDetached(installerFullPath, arguments, QString(), &pid);
|
||||||
|
}
|
||||||
|
|
||||||
void TestRunner::saveExistingHighFidelityAppDataFolder() {
|
void TestRunner::saveExistingHighFidelityAppDataFolder() {
|
||||||
QString dataDirectory{ "NOT FOUND" };
|
QString dataDirectory{ "NOT FOUND" };
|
||||||
|
|
||||||
|
@ -44,25 +62,25 @@ void TestRunner::saveExistingHighFidelityAppDataFolder() {
|
||||||
dataDirectory = qgetenv("USERPROFILE") + "\\AppData\\Roaming";
|
dataDirectory = qgetenv("USERPROFILE") + "\\AppData\\Roaming";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
appDataFolder = dataDirectory + "\\High Fidelity";
|
_appDataFolder = dataDirectory + "\\High Fidelity";
|
||||||
|
|
||||||
if (!appDataFolder.exists()) {
|
if (!_appDataFolder.exists()) {
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
"The High Fidelity data folder was not found in " + dataDirectory);
|
"The High Fidelity data folder was not found in " + dataDirectory);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original folder is saved in a unique name
|
// The original folder is saved in a unique name
|
||||||
savedAppDataFolder = dataDirectory + "/fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf";
|
_savedAppDataFolder = dataDirectory + "/" + _uniqueFolderName;
|
||||||
appDataFolder.rename(QDir::fromNativeSeparators(appDataFolder.path()), QDir::toNativeSeparators(savedAppDataFolder.path()));
|
_appDataFolder.rename(_appDataFolder.path(), _savedAppDataFolder.path());
|
||||||
|
|
||||||
QDir().mkdir(appDataFolder.path());
|
QDir().mkdir(_appDataFolder.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::restoreHighFidelityAppDataFolder() {
|
void TestRunner::restoreHighFidelityAppDataFolder() {
|
||||||
QDir().rmdir(appDataFolder.path());
|
QDir().rmdir(_appDataFolder.path());
|
||||||
|
|
||||||
appDataFolder.rename(QDir::fromNativeSeparators(savedAppDataFolder.path()), QDir::toNativeSeparators(appDataFolder.path()));
|
_appDataFolder.rename(_savedAppDataFolder.path(), _appDataFolder.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::selectTemporaryFolder() {
|
void TestRunner::selectTemporaryFolder() {
|
||||||
|
|
|
@ -15,26 +15,33 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
#include "Downloader.h"
|
#include "Downloader.h"
|
||||||
|
#include "ui/BusyWindow.h"
|
||||||
|
|
||||||
class TestRunner : public QObject {
|
class TestRunner : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TestRunner(QObject *parent = 0);
|
explicit TestRunner(QObject* parent = 0);
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
void installerDownloadComplete();
|
void installerDownloadComplete();
|
||||||
|
void runInstaller();
|
||||||
|
|
||||||
void saveExistingHighFidelityAppDataFolder();
|
void saveExistingHighFidelityAppDataFolder();
|
||||||
void restoreHighFidelityAppDataFolder();
|
void restoreHighFidelityAppDataFolder();
|
||||||
void selectTemporaryFolder();
|
void selectTemporaryFolder();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QDir appDataFolder;
|
QDir _appDataFolder;
|
||||||
QDir savedAppDataFolder;
|
QDir _savedAppDataFolder;
|
||||||
|
|
||||||
QString _tempDirectory;
|
QString _tempDirectory;
|
||||||
|
|
||||||
Downloader* _downloader;
|
Downloader* _downloader;
|
||||||
|
|
||||||
|
const QString _uniqueFolderName{ "fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
|
||||||
|
const QString _installerFilename{ "HighFidelity-Beta-latest-dev.exe" };
|
||||||
|
|
||||||
|
BusyWindow _busyWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_testRunner_h
|
#endif // hifi_testRunner_h
|
Loading…
Reference in a new issue