return CSYNC_NOT_EXCLUDED;
}
-auto ExcludedFiles::csyncTraversalMatchFun()
- -> std::function<CSYNC_EXCLUDE_TYPE(const char *path, ItemType filetype)>
-{
- return [this](const char *path, ItemType filetype) { return this->traversalPatternMatch(path, filetype); };
-}
-
/**
* On linux we used to use fnmatch with FNM_PATHNAME, but the windows function we used
* didn't have that behavior. wildcardsMatchSlash can be used to control which behavior
void setClientVersion(Version version);
/**
- * Generate a hook for traversal exclude pattern matching
- * that csync can use.
+ * @brief Check if the given path should be excluded in a traversal situation.
+ *
+ * It does only part of the work that full() does because it's assumed
+ * that all leading directories have been run through traversal()
+ * before. This can be significantly faster.
+ *
+ * That means for 'foo/bar/file' only ('foo/bar/file', 'file') is checked
+ * against the exclude patterns.
*
- * Careful: The function will only be valid for as long as this
- * ExcludedFiles instance stays alive.
+ * @param Path is folder-relative, should not start with a /.
+ *
+ * Note that this only matches patterns. It does not check whether the file
+ * or directory pointed to is hidden (or whether it even exists).
*/
- auto csyncTraversalMatchFun()
- -> std::function<CSYNC_EXCLUDE_TYPE(const char *path, ItemType filetype)>;
+ CSYNC_EXCLUDE_TYPE traversalPatternMatch(const char *path, ItemType filetype);
public slots:
/**
*/
CSYNC_EXCLUDE_TYPE fullPatternMatch(const char *path, ItemType filetype) const;
- /**
- * @brief Check if the given path should be excluded in a traversal situation.
- *
- * It does only part of the work that full() does because it's assumed
- * that all leading directories have been run through traversal()
- * before. This can be significantly faster.
- *
- * That means for 'foo/bar/file' only ('foo/bar/file', 'file') is checked
- * against the exclude patterns.
- *
- * @param Path is folder-relative, should not start with a /.
- *
- * Note that this only matches patterns. It does not check whether the file
- * or directory pointed to is hidden (or whether it even exists).
- */
- CSYNC_EXCLUDE_TYPE traversalPatternMatch(const char *path, ItemType filetype);
-
// Our BasePath need to end with '/'
class BasePathByteArray : public QByteArray
{
bool ProcessDirectoryJob::handleExcluded(const QString &path, bool isDirectory, bool isHidden, bool isSymlink)
{
// FIXME! call directly, without char* conversion
- auto excluded = _discoveryData->_excludes->csyncTraversalMatchFun()(path.toUtf8(), isDirectory ? ItemTypeDirectory : ItemTypeFile);
+ auto excluded = _discoveryData->_excludes->traversalPatternMatch(path.toUtf8(), isDirectory ? ItemTypeDirectory : ItemTypeFile);
// FIXME: move to ExcludedFiles 's regexp ?
bool isInvalidPattern = false;