mirror of
https://github.com/overte-org/overte.git
synced 2025-07-28 18:00:21 +02:00
Merge branch 'qt-launcher' of github.com:danteruiz/hifi into qt-launcher
This commit is contained in:
commit
d752d95a8d
4 changed files with 11 additions and 7 deletions
|
@ -76,7 +76,7 @@ bool swapLaunchers(const QString& oldLauncherPath, const QString& newLauncherPat
|
||||||
|
|
||||||
|
|
||||||
void cleanLogFile() {
|
void cleanLogFile() {
|
||||||
QDir launcherDirectory = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
|
QDir launcherDirectory = PathUtils::getLogsDirectory();
|
||||||
launcherDirectory.mkpath(launcherDirectory.absolutePath());
|
launcherDirectory.mkpath(launcherDirectory.absolutePath());
|
||||||
QString filename = launcherDirectory.absoluteFilePath("Log.txt");
|
QString filename = launcherDirectory.absoluteFilePath("Log.txt");
|
||||||
QString tmpFilename = launcherDirectory.absoluteFilePath("Log-last.txt");
|
QString tmpFilename = launcherDirectory.absoluteFilePath("Log-last.txt");
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
LauncherInstaller::LauncherInstaller(const QString& applicationFilePath) {
|
LauncherInstaller::LauncherInstaller() {
|
||||||
_launcherInstallDir = PathUtils::getLauncherDirectory();
|
_launcherInstallDir = PathUtils::getLauncherDirectory();
|
||||||
_launcherApplicationsDir = PathUtils::getApplicationsDirectory();
|
_launcherApplicationsDir = PathUtils::getApplicationsDirectory();
|
||||||
qDebug() << "Launcher install dir: " << _launcherInstallDir.absolutePath();
|
qDebug() << "Launcher install dir: " << _launcherInstallDir.absolutePath();
|
||||||
|
@ -23,7 +23,10 @@ LauncherInstaller::LauncherInstaller(const QString& applicationFilePath) {
|
||||||
|
|
||||||
_launcherInstallDir.mkpath(_launcherInstallDir.absolutePath());
|
_launcherInstallDir.mkpath(_launcherInstallDir.absolutePath());
|
||||||
_launcherApplicationsDir.mkpath(_launcherApplicationsDir.absolutePath());
|
_launcherApplicationsDir.mkpath(_launcherApplicationsDir.absolutePath());
|
||||||
QFileInfo fileInfo(applicationFilePath);
|
char appPath[MAX_PATH];
|
||||||
|
GetModuleFileNameA(NULL, appPath, MAX_PATH);
|
||||||
|
QString applicationRunningPath = appPath;
|
||||||
|
QFileInfo fileInfo(applicationRunningPath);
|
||||||
_launcherRunningFilePath = fileInfo.absoluteFilePath();
|
_launcherRunningFilePath = fileInfo.absoluteFilePath();
|
||||||
_launcherRunningDirPath = fileInfo.absoluteDir().absolutePath();
|
_launcherRunningDirPath = fileInfo.absoluteDir().absolutePath();
|
||||||
qDebug() << "Launcher running file path: " << _launcherRunningFilePath;
|
qDebug() << "Launcher running file path: " << _launcherRunningFilePath;
|
||||||
|
@ -44,11 +47,12 @@ void LauncherInstaller::install() {
|
||||||
bool didRemove = QFile::remove(oldLauncherPath);
|
bool didRemove = QFile::remove(oldLauncherPath);
|
||||||
qDebug() << "did remove file: " << didRemove;
|
qDebug() << "did remove file: " << didRemove;
|
||||||
}
|
}
|
||||||
|
qDebug() << "Current launcher location: " << _launcherRunningFilePath;
|
||||||
bool success = QFile::copy(_launcherRunningFilePath, oldLauncherPath);
|
bool success = QFile::copy(_launcherRunningFilePath, oldLauncherPath);
|
||||||
if (success) {
|
if (success) {
|
||||||
qDebug() << "successful";
|
qDebug() << "Launcher installed: " << oldLauncherPath;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "not successful";
|
qDebug() << "Failed to install: " << oldLauncherPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteShortcuts();
|
deleteShortcuts();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
class LauncherInstaller {
|
class LauncherInstaller {
|
||||||
public:
|
public:
|
||||||
LauncherInstaller(const QString& applicationFilePath);
|
LauncherInstaller();
|
||||||
~LauncherInstaller() = default;
|
~LauncherInstaller() = default;
|
||||||
|
|
||||||
void install();
|
void install();
|
||||||
|
|
|
@ -62,7 +62,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
LauncherInstaller launcherInstaller(argv[0]);
|
LauncherInstaller launcherInstaller;
|
||||||
if (options->contains("--uninstall") || options->contains("--resumeUninstall")) {
|
if (options->contains("--uninstall") || options->contains("--resumeUninstall")) {
|
||||||
launcherInstaller.uninstall();
|
launcherInstaller.uninstall();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue