Expanded skip_file config parameter to support spaces and pathing

This commit is contained in:
Robert Foster 2018-07-05 08:10:21 +09:30
parent 83c28ba3b6
commit a4387d5fc4
3 changed files with 13 additions and 1 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ onedrive
onedrive.o
onedrive.service
version
onedrive@.service

View file

@ -5,6 +5,7 @@ import std.path;
import std.regex;
import std.stdio;
import util;
static import log;
final class SelectiveSync
{
@ -33,13 +34,17 @@ final class SelectiveSync
// Does the file match skip_file config entry?
// Returns true if the file matches a skip_file config entry
// Returns false if no match
log.vlog("isNameExcluded for name '", name, "': ", !name.matchFirst(mask).empty);
return !name.matchFirst(mask).empty;
}
// config sync_list file handling
// also incorporates skip_file config parameter for expanded regex path matching
bool isPathExcluded(string path)
{
return .isPathExcluded(path, paths);
log.vlog("isPathExcluded for path '", path, "': ", .isPathExcluded(path, paths));
log.vlog("Path Matched for path '", path, "': ", !path.matchFirst(mask).empty);
return .isPathExcluded(path, paths) || !path.matchFirst(mask).empty;
}
}

View file

@ -100,6 +100,12 @@ Regex!char wild2regex(const(char)[] pattern)
case '+':
str ~= "\\+";
break;
case ' ':
str ~= "\\s+";
break;
case '/':
str ~= "\\/";
break;
default:
str ~= c;
break;