karchivemanager: add assert to catch current directory changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-04-05 02:51:26 +03:00
parent b532d6667e
commit 7fdd3feed8

View file

@ -788,7 +788,7 @@ bool KArchiveManager::extract(const QStringList &paths, const QString &destinati
return result;
}
const QString currendir = QDir::currentPath();
const QString currentdir = QDir::currentPath();
if (!QDir::setCurrent(destination)) {
kWarning() << "could not change to destination directory" << destination;
return result;
@ -844,8 +844,9 @@ bool KArchiveManager::extract(const QStringList &paths, const QString &destinati
d->closeWrite(m_write);
d->closeRead(m_read);
if (!QDir::setCurrent(currendir)) {
kWarning() << "could not change to orignal directory" << currendir;
Q_ASSERT_X(currentdir == QDir::currentPath(), "KArchiveManager::extract", "Current directory changed");
if (!QDir::setCurrent(currentdir)) {
kWarning() << "could not change to orignal directory" << currentdir;
}
if (!notfound.isEmpty()) {