Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-10-29 14:23:48 +0300
committerOlivier Goffart <ogoffart@woboq.com>2014-10-29 14:23:48 +0300
commit7810da51a8cdd2f8bc109c823b3e4dc2010e9a81 (patch)
tree758c3f318ffa0e68377a9787bb04e643ffd1ed5f /src/mirall
parenta47013845033f8b0328d71340f5be02343e6e7f7 (diff)
Propagator: report error when deleting directories
Will help to understand why a directory cannot be removed Will help for #2348
Diffstat (limited to 'src/mirall')
-rw-r--r--src/mirall/propagatorjobs.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/mirall/propagatorjobs.cpp b/src/mirall/propagatorjobs.cpp
index f3895e09e..b3ea60e85 100644
--- a/src/mirall/propagatorjobs.cpp
+++ b/src/mirall/propagatorjobs.cpp
@@ -50,7 +50,8 @@
namespace Mirall {
// Code copied from Qt5's QDir::removeRecursively
-static bool removeRecursively(const QString &path)
+// (and modified to report the error)
+static bool removeRecursively(const QString &path, QString &error)
{
bool success = true;
QDirIterator di(path, QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot);
@@ -58,15 +59,28 @@ static bool removeRecursively(const QString &path)
di.next();
const QFileInfo& fi = di.fileInfo();
bool ok;
- if (fi.isDir() && !fi.isSymLink())
- ok = removeRecursively(di.filePath()); // recursive
- else
- ok = QFile::remove(di.filePath());
+ if (fi.isDir() && !fi.isSymLink()) {
+ ok = removeRecursively(di.filePath(), error); // recursive
+ } else {
+ QFile f(di.filePath());
+ ok = f.remove();
+ if (!ok) {
+ error += PropagateLocalRemove::tr("Error removing '%1': %2; ").
+ arg(QDir::toNativeSeparators(f.fileName()), f.errorString());
+ qDebug() << "Error removing " << f.fileName() << ':' << f.errorString();
+ }
+ }
if (!ok)
success = false;
}
- if (success)
+ if (success) {
success = QDir().rmdir(path);
+ if (!success) {
+ error += PropagateLocalRemove::tr("Could not remove directory '%1'; ")
+ .arg(QDir::toNativeSeparators(path));
+ qDebug() << "Error removing directory" << path;
+ }
+ }
return success;
}
@@ -83,9 +97,9 @@ void PropagateLocalRemove::start()
}
if (_item._isDirectory) {
- if (QDir(filename).exists() && !removeRecursively(filename)) {
- done(SyncFileItem::NormalError, tr("Could not remove directory %1")
- .arg(QDir::toNativeSeparators(filename)));
+ QString error;
+ if (QDir(filename).exists() && !removeRecursively(filename, error)) {
+ done(SyncFileItem::NormalError, error);
return;
}
} else {