From 28de3ccbe989cadd163ad4639048aa35229bfea1 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 27 Nov 2012 15:45:41 +0100 Subject: Fix directory clean-up (again). - Don't follow symlinks. - Mark current subtree as non-empty if removal of empty directory fails and we were asked not to abort. Change-Id: Ib46ed34f7e70eebca6f07c91d6e1db64f4954bcb Reviewed-by: Oswald Buddenhagen Reviewed-by: Joerg Bornemann --- src/lib/buildgraph/artifactcleaner.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/buildgraph/artifactcleaner.cpp b/src/lib/buildgraph/artifactcleaner.cpp index 56af22b51..64c19d828 100644 --- a/src/lib/buildgraph/artifactcleaner.cpp +++ b/src/lib/buildgraph/artifactcleaner.cpp @@ -161,7 +161,7 @@ void ArtifactCleaner::removeEmptyDirectories(const QString &rootDir, const Build QDirIterator it(rootDir, QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); while (it.hasNext()) { it.next(); - if (it.fileInfo().isDir()) + if (!it.fileInfo().isSymLink() && it.fileInfo().isDir()) removeEmptyDirectories(it.filePath(), options, &subTreeIsEmpty); else subTreeIsEmpty = false; @@ -174,10 +174,11 @@ void ArtifactCleaner::removeEmptyDirectories(const QString &rootDir, const Build throw error; qbsWarning() << error.toString(); m_hasError = true; + subTreeIsEmpty = false; } - } else if (isEmpty) { - *isEmpty = subTreeIsEmpty; } + if (!subTreeIsEmpty && isEmpty) + *isEmpty = false; } } // namespace Internal -- cgit v1.2.3