Skip to content

Commit

Permalink
if an exclude file is deleted, skip it and remove it from internal list
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed May 12, 2022
1 parent 952eefc commit da9e3bd
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/csync/csync_exclude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,24 @@ bool ExcludedFiles::reloadExcludeFiles()
bool success = true;
const auto keys = _excludeFiles.keys();
for (const auto& basePath : keys) {
for (const auto &excludeFile : _excludeFiles.value(basePath)) {
auto itValue = _excludeFiles.find(basePath);
if (itValue == std::end(_excludeFiles)) {
continue;
}
auto &excludeFiles = *itValue;
for (auto excludeFileIt = std::begin(excludeFiles); excludeFileIt != std::end(excludeFiles); ) {
const auto &excludeFile = *excludeFileIt;
QFile file(excludeFile);
if (file.exists() && file.open(QIODevice::ReadOnly)) {
loadExcludeFilePatterns(basePath, file);
if (!file.exists()) {
excludeFileIt = excludeFiles.erase(excludeFileIt);
} else {
success = false;
qWarning() << "System exclude list file could not be opened:" << excludeFile;
if (file.open(QIODevice::ReadOnly)) {
loadExcludeFilePatterns(basePath, file);
} else {
success = false;
qWarning() << "System exclude list file could not be opened:" << excludeFile;
}
++excludeFileIt;
}
}
}
Expand Down

0 comments on commit da9e3bd

Please sign in to comment.