lib/model: Handle (?d) deletes of directories (fixes #3164)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3170
This commit is contained in:
Audrius Butkevicius
2016-05-23 23:32:08 +00:00
committed by Jakob Borg
parent b78bfc0a43
commit 915e1ac7de
4 changed files with 117 additions and 4 deletions

View File

@@ -676,8 +676,9 @@ func (f *rwFolder) deleteDir(file protocol.FileInfo, matcher *ignore.Matcher) {
if dir != nil {
files, _ := dir.Readdirnames(-1)
for _, dirFile := range files {
if defTempNamer.IsTemporary(dirFile) || (matcher != nil && matcher.Match(filepath.Join(file.Name, dirFile)).IsDeletable()) {
osutil.InWritableDir(osutil.Remove, filepath.Join(realName, dirFile))
fullDirFile := filepath.Join(file.Name, dirFile)
if defTempNamer.IsTemporary(dirFile) || (matcher != nil && matcher.Match(fullDirFile).IsDeletable()) {
osutil.RemoveAll(fullDirFile)
}
}
dir.Close()