diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2012-11-27 15:45:41 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2012-11-27 16:29:08 +0100 |
commit | 28de3ccbe989cadd163ad4639048aa35229bfea1 (patch) | |
tree | 0920dae2d952cf600bb1d350302b4952f00e3bd6 | |
parent | 5c8ba6a582e2ad825bdfdb9fb55ae650f2a12da0 (diff) |
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 <oswald.buddenhagen@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r-- | src/lib/buildgraph/artifactcleaner.cpp | 7 |
1 files 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 |