mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kutils: remove the temporary archive if error occurs in KArchive::add() and KArchive::remove()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
212cc9717a
commit
45110ac273
1 changed files with 6 additions and 2 deletions
|
@ -688,13 +688,15 @@ bool KArchive::add(const QStringList &paths, const QByteArray &strip, const QByt
|
|||
|
||||
if (result) {
|
||||
kDebug() << "Replacing" << d->m_path << "with" << tmpfile;
|
||||
|
||||
// TODO: set permissions on file after copy, same as the original
|
||||
result = (KDE::rename(tmpfile, d->m_path) != -1);
|
||||
if (!result) {
|
||||
d->m_error = i18n("Could not move: %1 to: %2", tmpfile, d->m_path);
|
||||
kDebug() << d->m_error;
|
||||
}
|
||||
} else {
|
||||
kDebug() << "Removing temporary archive" << tmpfile;
|
||||
QFile::remove(tmpfile);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(paths);
|
||||
|
@ -796,12 +798,14 @@ bool KArchive::remove(const QStringList &paths) const
|
|||
|
||||
if (result) {
|
||||
kDebug() << "Replacing" << d->m_path << "with" << tmpfile;
|
||||
|
||||
result = (KDE::rename(tmpfile, d->m_path) != -1);
|
||||
if (!result) {
|
||||
d->m_error = i18n("Could not move: %1 to: %2", tmpfile, d->m_path);
|
||||
kDebug() << d->m_error;
|
||||
}
|
||||
} else {
|
||||
kDebug() << "Removing temporary archive" << tmpfile;
|
||||
QFile::remove(tmpfile);
|
||||
}
|
||||
|
||||
if (!notfound.isEmpty()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue