diff options
author | Frerich Raabe <raabe@froglogic.com> | 2016-01-14 11:25:03 +0100 |
---|---|---|
committer | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-02-29 12:20:54 +0000 |
commit | adfdbb45b128fb7fc3d35da61bb6706551b25f01 (patch) | |
tree | 94788696f79a46e6400fc5194399d7d6c608cd50 /src/libs/kdtools | |
parent | 63e61f2d73f97dd8a88dc5b91377afdcbffa338e (diff) |
Fixed deleting files when uninstalling on OS X
Uninstalling packages on OS X didn't seem to work very reliably, it
often (always?) seemed to not remove a couple of files. When clicking
the 'Show Progress' button while uninstalling, it became apparent that
the paths to all the files to remove were computed wrongly: instead of
deleting e.g. the file
/tmp/installdir/foo.txt
The uninstaller attempted to remove
/tmp/installdir/Uninstall.app/foo.txt
What happens is when uninstalling, the ExtractArchiveOperation class
(which performs deletion of installed files in its 'undoOperation'
reimplementation) reads the files which were installed from the XML
markup embedded in the maintenance tool binary (this happens in
UpdateOperation::fromXml()). The paths to the files which were installed
make use of a special '@RELOCATABLE_PATH@' placeholder which denotes the
effective installation directory. This placeholder is meant to be
replaced with the actual installation directory, which is assumed to be
the directory where the maintenance tool resides, i.e. what
QCoreApplication::applicationDirPath();.
On OS X however, the maintenance tool is an app bundle, i.e. the actual
binary is not in
/tmp/installdir/Uninstall
but rather
/tmp/installdir/Uninstall.app/Contents/MacOS/Uninstall
The code already called the QInstaller:isInBundle() utility function to
handle this case, but did so wrongly: isInBundle() returns the directory
to the app bundle, i.e.
/tmp/installdir/Uninstall.app
What we want though is just '/tmp/installdir'. Hence, let's go one
directory up.
Change-Id: I927a453d7fbdd1048ff3d2172bd3cfec3a563b4a
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'src/libs/kdtools')
-rw-r--r-- | src/libs/kdtools/updateoperation.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libs/kdtools/updateoperation.cpp b/src/libs/kdtools/updateoperation.cpp index 965871fda..2a10880b6 100644 --- a/src/libs/kdtools/updateoperation.cpp +++ b/src/libs/kdtools/updateoperation.cpp @@ -460,7 +460,9 @@ QDomDocument UpdateOperation::toXml() const bool UpdateOperation::fromXml(const QDomDocument &doc) { QString target = QCoreApplication::applicationDirPath(); - QInstaller::isInBundle(target, &target); // Does not change target on non OSX platforms. + // Does not change target on non OSX platforms. + if (QInstaller::isInBundle(target, &target)) + target = QDir::cleanPath(target + QLatin1String("/..")); QStringList args; const QDomElement root = doc.documentElement(); |