Update "hidden" directory & skip_file handling

* Partial rollback of 570d42269e to
original logic behind isNameExcluded()
* Removed .* from default skip_file configuration
This commit is contained in:
abraunegg 2018-04-16 21:39:45 +10:00
parent 961e7ada3d
commit 835806f0eb
3 changed files with 13 additions and 11 deletions

View file

@ -27,7 +27,9 @@ final class Config
void init() void init()
{ {
setValue("sync_dir", "~/OneDrive"); setValue("sync_dir", "~/OneDrive");
setValue("skip_file", ".*|~*"); // Configure to skip ONLY temp files (~*.doc etc) by default
// Prior configuration was: .*|~*
setValue("skip_file", "~*");
if (!load(userConfigFilePath)) { if (!load(userConfigFilePath)) {
log.vlog("No config file found, using defaults"); log.vlog("No config file found, using defaults");
} }

View file

@ -27,18 +27,16 @@ final class SelectiveSync
this.mask = wild2regex(mask); this.mask = wild2regex(mask);
} }
// config file skip_file parameter
bool isNameExcluded(string name) bool isNameExcluded(string name)
{ {
auto validName = isValidFilename(name); // Does the file match skip_file config entry?
if (validName){ // Returns true if the file matches a skip_file config entry
// This is a valid filename - do NOT exclude // Returns false if no match
return false; return !name.matchFirst(mask).empty;
} else {
// Invalid file name - exclude this name
return true;
}
} }
// config sync_list file handling
bool isPathExcluded(string path) bool isPathExcluded(string path)
{ {
return .isPathExcluded(path, paths); return .isPathExcluded(path, paths);

View file

@ -731,10 +731,10 @@ final class SyncEngine
return; return;
} }
// skip filtered items // filter out user configured items to skip
if (path != ".") { if (path != ".") {
if (selectiveSync.isNameExcluded(baseName(path))) { if (selectiveSync.isNameExcluded(baseName(path))) {
log.vlog("Skipping item - name excluded: ", path); log.vlog("Skipping item - excluded by skip_file config: ", path);
return; return;
} }
if (selectiveSync.isPathExcluded(path)) { if (selectiveSync.isPathExcluded(path)) {
@ -743,6 +743,8 @@ final class SyncEngine
} }
} }
// This item passed all the unwanted checks
// We want to upload this new item
if (isDir(path)) { if (isDir(path)) {
Item item; Item item;
if (!itemdb.selectByPath(path, defaultDriveId, item)) { if (!itemdb.selectByPath(path, defaultDriveId, item)) {