Handle deleting a directory
This commit is contained in:
parent
37fbae0fcd
commit
3b33e803e3
|
@ -621,12 +621,15 @@ func (fs *Filesystem) Delete(p string) error {
|
||||||
fs.Server.Log().WithField("error", err).WithField("path", resolved).Warn("error while attempting to stat file before deletion")
|
fs.Server.Log().WithField("error", err).WithField("path", resolved).Warn("error while attempting to stat file before deletion")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: handle deleting a directory by finding its current size.
|
if !st.IsDir() {
|
||||||
go func (st os.FileInfo) {
|
atomic.SwapInt64(&fs.diskUsage, -st.Size())
|
||||||
if !st.IsDir() {
|
} else {
|
||||||
atomic.SwapInt64(&fs.diskUsage, fs.diskUsage - st.Size())
|
go func(st os.FileInfo, resolved string) {
|
||||||
}
|
if s, err := fs.DirectorySize(resolved); err == nil {
|
||||||
}(st)
|
atomic.AddInt64(&fs.diskUsage, -s)
|
||||||
|
}
|
||||||
|
}(st, resolved)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return os.RemoveAll(resolved)
|
return os.RemoveAll(resolved)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user