summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2013-11-06 13:05:16 +0100
committerKarsten Heimrich <karsten.heimrich@digia.com>2013-11-06 13:51:55 +0100
commitfd26174d2cf0d8b0887007075a6be2933a1f595a (patch)
tree67ca667d01adabe17991831c132e4db6c5d28ff4 /src
parent113c0e0450b09816aaa43e26f9646e594533b33c (diff)
Always only delete the install directory if it's empty.
We have to reset the force removal flag inside the operation to not delete any other files/ folders than our own created. Once the flag is set to false, the operation will fail on any file/ folder still left in the install path. Note: the config.rcc is a dummy file to calm down settings class parser warnings. Change-Id: I66efb5836e310bdb1b64e5647ee76c058cea2a7e Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs/installer/packagemanagercore.cpp13
-rw-r--r--src/libs/installer/progresscoordinator.h4
2 files changed, 16 insertions, 1 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index 5f33d941a..c920176c4 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -635,6 +635,19 @@ void PackageManagerCore::rollBackInstallation()
const bool becameAdmin = !d->m_FSEngineClientHandler->isActive()
&& operation->value(QLatin1String("admin")).toBool() && gainAdminRights();
+ if (operation->hasValue(QLatin1String("uninstall-only"))) {
+ // We know the mkdir operation which is creating the target path. If we do a
+ // full uninstall, prevent a forced remove of the full install path including the
+ // target , instead try to remove the target only and only if it is empty,
+ // otherwise fail silently. Note: we will ever experience this only -if-
+ // RemoveTargetDir is set, otherwise the operation does not exist at all.
+ const bool isMkDir = (operation->name() == QLatin1String("Mkdir"));
+ const bool forceremoval = QVariant(value(QLatin1String("forceremoval"))).toBool();
+ const bool uninstallOnly = operation->value(QLatin1String("uninstall-only")).toBool();
+ if (isMkDir && uninstallOnly && forceremoval)
+ operation->setValue(QLatin1String("forceremoval"), false);
+ }
+
PackageManagerCorePrivate::performOperationThreaded(operation, PackageManagerCorePrivate::Undo);
const QString componentName = operation->value(QLatin1String("component")).toString();
diff --git a/src/libs/installer/progresscoordinator.h b/src/libs/installer/progresscoordinator.h
index 263b25695..bdd154195 100644
--- a/src/libs/installer/progresscoordinator.h
+++ b/src/libs/installer/progresscoordinator.h
@@ -42,13 +42,15 @@
#ifndef PROGRESSCOORDINATOR_H
#define PROGRESSCOORDINATOR_H
+#include "installer_global.h"
+
#include <QtCore/QHash>
#include <QtCore/QObject>
#include <QtCore/QPointer>
namespace QInstaller {
-class ProgressCoordinator : public QObject
+class INSTALLER_EXPORT ProgressCoordinator : public QObject
{
Q_OBJECT