Fix Mkdir undo operation fail to remove directory in Settings operation

Related to 0a842140f5d7cc7383c5266acbbc74428dd82014. MkdirOperation
object instantiated in SettingsOperation::undoOperation() doesn't have
reference to PackageManagerCore instance. As such, replacing
@RELOCATABLE_PATH@ with targetDir value can't be done and the created
settings file path, being invalid, doesn't get removed.

Pass reference of the package manager core which the Settings operation
belongs to, to MkdirOperation object, so @RELOCATABLE_PATH@ will be
replaced with core's targetDir value.

Task-number: QTIFW-1365
Change-Id: I327d8a63320ecec0e1d51fe7ed899d236fbd21e2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
This commit is contained in:
Arttu Tarkiainen 2019-07-22 16:27:04 +03:00
parent 6d5c3d36ea
commit 864aaa7ea3

View File

@ -180,7 +180,7 @@ bool SettingsOperation::undoOperation()
if (!settingsFile.remove())
qWarning().noquote() << settingsFile.errorString();
if (!value(QLatin1String("createddir")).toString().isEmpty()) {
KDUpdater::MkdirOperation mkDirOperation;
KDUpdater::MkdirOperation mkDirOperation(packageManager());
mkDirOperation.setArguments(QStringList() << QFileInfo(path).absolutePath());
mkDirOperation.setValue(QLatin1String("createddir"), value(QLatin1String("createddir")));