From 5d05df312405b7b82f7af059e17e4992958be1ef Mon Sep 17 00:00:00 2001 From: Iakov Davydov Date: Thu, 16 Nov 2017 15:38:00 +0100 Subject: [PATCH] ListContainsExcludeFile: checks for exclude file in the list --- fs/filter.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fs/filter.go b/fs/filter.go index ba9150c2f..eaa8255c4 100644 --- a/fs/filter.go +++ b/fs/filter.go @@ -385,6 +385,23 @@ func (f *Filter) includeRemote(remote string) bool { return true } +// ListContainsExcludeFile checks if exclude file is present in the list. +func (f *Filter) ListContainsExcludeFile(entries DirEntries) bool { + if len(f.ExcludeFile) == 0 { + return false + } + for _, entry := range entries { + obj, ok := entry.(Object) + if ok { + basename := path.Base(obj.Remote()) + if basename == f.ExcludeFile { + return true + } + } + } + return false +} + // IncludeDirectory returns whether this directory should be included // in the sync or not. func (f *Filter) IncludeDirectory(remote string) bool {