diff options
author | Katja Marttila <katja.marttila@qt.io> | 2020-11-19 07:25:01 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2020-12-07 07:36:36 +0200 |
commit | e82ab45ed71d9b807dc23eae559c759f4584b79d (patch) | |
tree | 1ff8a7379a7c0fbd1908783404babd9b83e4d414 /src/libs/installer/extractarchiveoperation.cpp | |
parent | b43ab89a64c6484a8af4be424ab695b956d7f7bc (diff) |
Add option to define operations in component.xml
Operations can from now on be declared also in component.xml. The
operations are performed, backuped and rollbacked the same way as they
would be when defined from scripting api.
Task-number: QTIFW-507
Change-Id: Ia509219b94737136c3de25db0cb0c72076b48380
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/installer/extractarchiveoperation.cpp')
-rw-r--r-- | src/libs/installer/extractarchiveoperation.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libs/installer/extractarchiveoperation.cpp b/src/libs/installer/extractarchiveoperation.cpp index 99dd88a7e..5b13b1f25 100644 --- a/src/libs/installer/extractarchiveoperation.cpp +++ b/src/libs/installer/extractarchiveoperation.cpp @@ -122,9 +122,15 @@ bool ExtractArchiveOperation::performOperation() QStringList files = callback.extractedFiles(); - const QString resourcesPath = targetDir + QLatin1Char('/') + QLatin1String("installerResources"); - QString fileDirectory = resourcesPath + QLatin1Char('/') + - archivePath.section(QLatin1Char('/'), 1, 1, QString::SectionSkipEmpty) + QLatin1Char('/'); + QString installDir = targetDir; + // If we have package manager in use (normal installer run) then use + // TargetDir for saving filenames, otherwise those would be saved to + // extracted folder. + if (packageManager()) + installDir = packageManager()->value(QLatin1String("TargetDir")); + const QString resourcesPath = installDir + QLatin1Char('/') + QLatin1String("installerResources"); + QString fileDirectory = resourcesPath + QLatin1Char('/') + archivePath.section(QLatin1Char('/'), 1, 1, + QString::SectionSkipEmpty) + QLatin1Char('/'); QString archiveFileName = archivePath.section(QLatin1Char('/'), 2, 2, QString::SectionSkipEmpty); QFileInfo fileInfo2(archiveFileName); QString suffix = fileInfo2.suffix(); @@ -145,7 +151,7 @@ bool ExtractArchiveOperation::performOperation() setDefaultFilePermissions(file.fileName(), DefaultFilePermissions::NonExecutable); QDataStream out (&file); for (int i = 0; i < files.count(); ++i) { - files[i] = replacePath(files.at(i), targetDir, QLatin1String(scRelocatable)); + files[i] = replacePath(files.at(i), installDir, QLatin1String(scRelocatable)); } out << files; setValue(QLatin1String("files"), file.fileName()); @@ -176,6 +182,8 @@ bool ExtractArchiveOperation::undoOperation() // If yes, files are listed in .dat instead of in a separate file. bool useStringListType(value(QLatin1String("files")).type() == QVariant::StringList); QString targetDir = arguments().at(1); + if (packageManager()) + targetDir = packageManager()->value(QLatin1String("TargetDir")); QStringList files; if (useStringListType) { files = value(QLatin1String("files")).toStringList(); |