4
0
mirror of https://github.com/QuasarApp/installer-framework.git synced 2025-05-04 01:09:33 +00:00

Fix file deletion when canceling installation

Task-number: QTIFW-1466
Change-Id: I2b9f000cddc63e9eccefb3d86f93ab05a5631581
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
This commit is contained in:
Katja Marttila 2019-11-08 08:03:57 +02:00
parent f667bf73d0
commit 8053f11af1

@ -150,18 +150,18 @@ bool ExtractArchiveOperation::undoOperation()
startUndoProcess(files);
} else {
const QString filePath = value(QLatin1String("files")).toString();
QString target = QCoreApplication::applicationDirPath();
QString targetDir = arguments().at(1);
// Does not change target on non macOS platforms.
if (QInstaller::isInBundle(target, &target))
target = QDir::cleanPath(target + QLatin1String("/.."));
QString fileName = replacePath(filePath, QLatin1String(scRelocatable), target);
if (QInstaller::isInBundle(targetDir, &targetDir))
targetDir = QDir::cleanPath(targetDir + QLatin1String("/.."));
QString fileName = replacePath(filePath, QLatin1String(scRelocatable), targetDir);
QFile file(fileName);
if (file.open(QIODevice::ReadOnly)) {
QDataStream in(&file);
in >> files;
for (int i = 0; i < files.count(); ++i)
files[i] = replacePath(files.at(i), QLatin1String(scRelocatable), target);
files[i] = replacePath(files.at(i), QLatin1String(scRelocatable), targetDir);
startUndoProcess(files);
QFileInfo fileInfo(file);
file.remove();