mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
count directories as files (fixes #607)
This commit is contained in:
parent
89885b9fb9
commit
a58564ff88
@ -129,7 +129,10 @@ func (v Staggered) clean() {
|
|||||||
switch mode := f.Mode(); {
|
switch mode := f.Mode(); {
|
||||||
case mode.IsDir():
|
case mode.IsDir():
|
||||||
filesPerDir[path] = 0
|
filesPerDir[path] = 0
|
||||||
|
if path != v.versionsPath {
|
||||||
|
dir := filepath.Dir(path)
|
||||||
|
filesPerDir[dir]++
|
||||||
|
}
|
||||||
case mode.IsRegular():
|
case mode.IsRegular():
|
||||||
extension := filepath.Ext(path)
|
extension := filepath.Ext(path)
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
@ -152,15 +155,17 @@ func (v Staggered) clean() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for path, numFiles := range filesPerDir {
|
for path, numFiles := range filesPerDir {
|
||||||
|
if numFiles > 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if path == v.versionsPath {
|
if path == v.versionsPath {
|
||||||
if debug {
|
if debug {
|
||||||
l.Debugln("Cleaner: versions dir is empty, don't delete", path)
|
l.Debugln("Cleaner: versions dir is empty, don't delete", path)
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if numFiles > 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
l.Debugln("Cleaner: deleting empty directory", path)
|
l.Debugln("Cleaner: deleting empty directory", path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user