mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-02 06:02:53 +02:00
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:
parent
961e7ada3d
commit
835806f0eb
|
@ -27,7 +27,9 @@ final class Config
|
|||
void init()
|
||||
{
|
||||
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)) {
|
||||
log.vlog("No config file found, using defaults");
|
||||
}
|
||||
|
|
|
@ -27,18 +27,16 @@ final class SelectiveSync
|
|||
this.mask = wild2regex(mask);
|
||||
}
|
||||
|
||||
// config file skip_file parameter
|
||||
bool isNameExcluded(string name)
|
||||
{
|
||||
auto validName = isValidFilename(name);
|
||||
if (validName){
|
||||
// This is a valid filename - do NOT exclude
|
||||
return false;
|
||||
} else {
|
||||
// Invalid file name - exclude this name
|
||||
return true;
|
||||
}
|
||||
// Does the file match skip_file config entry?
|
||||
// Returns true if the file matches a skip_file config entry
|
||||
// Returns false if no match
|
||||
return !name.matchFirst(mask).empty;
|
||||
}
|
||||
|
||||
// config sync_list file handling
|
||||
bool isPathExcluded(string path)
|
||||
{
|
||||
return .isPathExcluded(path, paths);
|
||||
|
|
|
@ -731,10 +731,10 @@ final class SyncEngine
|
|||
return;
|
||||
}
|
||||
|
||||
// skip filtered items
|
||||
// filter out user configured items to skip
|
||||
if (path != ".") {
|
||||
if (selectiveSync.isNameExcluded(baseName(path))) {
|
||||
log.vlog("Skipping item - name excluded: ", path);
|
||||
log.vlog("Skipping item - excluded by skip_file config: ", path);
|
||||
return;
|
||||
}
|
||||
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)) {
|
||||
Item item;
|
||||
if (!itemdb.selectByPath(path, defaultDriveId, item)) {
|
||||
|
|
Loading…
Reference in a new issue