Merge pull request #435 from Murmele/flatpakUninstall

Flatpak uninstall
This commit is contained in:
Murmele 2023-01-22 19:43:06 +01:00 committed by GitHub
commit 627f73d9fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 1 deletions

View File

@ -5,7 +5,7 @@ project(Gittyup)
set(GITTYUP_NAME "Gittyup")
set(GITTYUP_VERSION_MAJOR 1)
set(GITTYUP_VERSION_MINOR 2)
set(GITTYUP_VERSION_PATCH 1)
set(GITTYUP_VERSION_PATCH 2)
set(GITTYUP_VERSION
"${GITTYUP_VERSION_MAJOR}.${GITTYUP_VERSION_MINOR}.${GITTYUP_VERSION_PATCH}"
)

View File

@ -1,3 +1,13 @@
### v1.2.2 - 2023-01-22
Bug fix release
#### Changed
* Fix flatpak install process
----
### v1.2.1 - 2023-01-22
Bug fix release

View File

@ -271,9 +271,36 @@ Updater *Updater::instance() {
}
#if defined(FLATPAK) || defined(DEBUG_FLATPAK)
bool Updater::uninstallGittyup(bool system) {
QString bash = git::Command::bashPath();
QString loc = system ? "--system" : "--user";
QStringList args;
args.append("-c");
args.append(QString("flatpak-spawn --host flatpak remove -y %1 "
"com.github.Murmele.Gittyup")
.arg(loc));
auto *p = new QProcess(this);
p->start(bash, args);
if (!p->waitForFinished()) {
const QString es = p->errorString();
qDebug() << "Uninstalling Gittyup failed: " + es;
return false;
} else {
qDebug() << "Uninstall: " + p->readAll();
}
p->deleteLater();
return true;
}
bool Updater::install(const DownloadRef &download, QString &error) {
QString path = download->file()->fileName();
// Ignore return value
uninstallGittyup(true);
uninstallGittyup(false);
QDir dir(QCoreApplication::applicationDirPath());
QStringList args;
args.append("-c");
@ -294,6 +321,7 @@ bool Updater::install(const DownloadRef &download, QString &error) {
} else {
qDebug() << "Successfully installed bundle: " + p->readAll();
}
p->deleteLater();
auto relauncher_cmd = dir.filePath("relauncher");
qDebug() << "Relauncher command: " << relauncher_cmd;

View File

@ -62,6 +62,10 @@ private:
bool install(const DownloadRef &download, QString &error);
#if defined(FLATPAK) || defined(DEBUG_FLATPAK)
bool uninstallGittyup(bool system);
#endif
QNetworkAccessManager mMgr;
};