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

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/csync/csync_exclude.cpp23
-rw-r--r--src/csync/csync_exclude.h7
2 files changed, 29 insertions, 1 deletions
diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp
index eb8507589..3f35e1781 100644
--- a/src/csync/csync_exclude.cpp
+++ b/src/csync/csync_exclude.cpp
@@ -37,6 +37,8 @@
#include <QFileInfo>
#include <QDir>
+Q_LOGGING_CATEGORY(lcCSyncExcludes, "nextcloud.sync.csync.excludes", QtInfoMsg)
+
/** Expands C-like escape sequences (in place)
*/
OCSYNC_EXPORT void csync_exclude_expand_escapes(QByteArray &input)
@@ -247,6 +249,23 @@ void ExcludedFiles::addExcludeFilePath(const QString &path)
}
}
+bool ExcludedFiles::removeExcludeFilePath(const QString &path)
+{
+ const QFileInfo excludeFileInfo(path);
+ const auto fileName = excludeFileInfo.fileName();
+ const auto basePath = fileName.compare(QStringLiteral("sync-exclude.lst"), Qt::CaseInsensitive) == 0
+ ? _localPath
+ : leftIncludeLast(path, QLatin1Char('/'));
+ auto &excludeFilesLocalPath = _excludeFiles[basePath];
+ auto it = std::find(excludeFilesLocalPath.begin(), excludeFilesLocalPath.end(), path);
+ if (it != excludeFilesLocalPath.end()) {
+ excludeFilesLocalPath.erase(it);
+ return true;
+ }
+
+ return false;
+}
+
void ExcludedFiles::setExcludeConflictFiles(bool onoff)
{
_excludeConflictFiles = onoff;
@@ -425,7 +444,9 @@ CSYNC_EXCLUDE_TYPE ExcludedFiles::traversalPatternMatch(const QString &path, Ite
addExcludeFilePath(absolutePath);
reloadExcludeFiles();
} else {
- qWarning() << "System exclude list file could not be read:" << absolutePath;
+ if (removeExcludeFilePath(absolutePath)) {
+ reloadExcludeFiles();
+ }
}
}
diff --git a/src/csync/csync_exclude.h b/src/csync/csync_exclude.h
index 856ac67ef..bebc05d00 100644
--- a/src/csync/csync_exclude.h
+++ b/src/csync/csync_exclude.h
@@ -80,6 +80,13 @@ public:
void addExcludeFilePath(const QString &path);
/**
+ * Removes a new path to a file containing exclude patterns (no op if the file is not in the list).
+ *
+ * Does not load the file. Use reloadExcludeFiles() afterwards.
+ */
+ bool removeExcludeFilePath(const QString &path);
+
+ /**
* Whether conflict files shall be excluded.
*
* Defaults to true.