1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 11:31:46 +00:00

Implemented safer temp cleanup and error reporting while fixing folded-directory size fallback to prevent double counting and aligning Homebrew cleanup traps with safe removal.

This commit is contained in:
Tw93
2026-01-12 15:45:31 +08:00
parent 5d5056fc9e
commit 93dee7b94d
4 changed files with 57 additions and 7 deletions

View File

@@ -471,11 +471,13 @@ func calculateDirSizeConcurrent(root string, largeFileChan chan<- fileEntry, duS
defer func() { <-duSem }()
return getDirectorySizeFromDu(path)
}()
if err == nil && size > 0 {
atomic.AddInt64(&total, size)
if err != nil || size <= 0 {
size = calculateDirSizeFast(path, filesScanned, dirsScanned, bytesScanned, currentPath)
} else {
atomic.AddInt64(bytesScanned, size)
atomic.AddInt64(dirsScanned, 1)
}
atomic.AddInt64(&total, size)
atomic.AddInt64(dirsScanned, 1)
}(fullPath)
continue
}