Delete box directory if exists

This commit is contained in:
sophia 2021-11-16 17:12:17 -06:00 committed by Paul Hinze
parent cb458e707a
commit 57afe56edd
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -210,11 +210,11 @@ func (b *Box) Destroy() (err error) {
}},
)
if err != nil {
b.logger.Trace("filed to delete box",
b.logger.Trace("failed to delete box",
"box", b.box.Name)
}
if _, err := os.Stat(b.box.Directory); err != nil {
if fs, _ := os.Stat(b.box.Directory); fs != nil {
b.logger.Trace("Removing box files",
"path", b.box.Directory)
return os.RemoveAll(b.box.Directory)