Update skip_dir config handling (#418)

* Original skip_dir handling expected an explicit match to path to match. With this patch, wildcard matching for any directory matching the path entry will be skipped
This commit is contained in:
abraunegg 2019-03-22 05:30:32 +11:00 committed by GitHub
parent 6b8b51a7cc
commit f2e007a1d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -39,7 +39,19 @@ final class SelectiveSync
// Does the directory name match skip_dir config entry?
// Returns true if the name matches a skip_dir config entry
// Returns false if no match
return !name.matchFirst(dirmask).empty;
// Try full path match first
if (!name.matchFirst(dirmask).empty) {
return true;
} else {
// check just the file name
string filename = baseName(name);
if(!filename.matchFirst(dirmask).empty) {
return true;
}
}
// no match
return false;
}
// config file skip_file parameter

View file

@ -1485,12 +1485,14 @@ final class SyncEngine
// filter out user configured items to skip
if (path != ".") {
if (isDir(path)) {
log.vdebug("Checking path: ", path);
if (selectiveSync.isDirNameExcluded(strip(path,"./"))) {
log.vlog("Skipping item - excluded by skip_dir config: ", path);
return;
}
}
if (isFile(path)) {
log.vdebug("Checking file: ", path);
if (selectiveSync.isFileNameExcluded(strip(path,"./"))) {
log.vlog("Skipping item - excluded by skip_file config: ", path);
return;