summaryrefslogtreecommitdiffstats
path: root/cache/filecache/filecache_pruner.go
diff options
context:
space:
mode:
Diffstat (limited to 'cache/filecache/filecache_pruner.go')
-rw-r--r--cache/filecache/filecache_pruner.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/cache/filecache/filecache_pruner.go b/cache/filecache/filecache_pruner.go
index 7f68c8b82..b77f5331b 100644
--- a/cache/filecache/filecache_pruner.go
+++ b/cache/filecache/filecache_pruner.go
@@ -17,6 +17,8 @@ import (
"io"
"os"
+ "github.com/gohugoio/hugo/hugofs"
+
"github.com/pkg/errors"
"github.com/spf13/afero"
)
@@ -121,18 +123,6 @@ func (c *Cache) pruneRootDir(force bool) (int, error) {
return 0, nil
}
- counter := 0
- // Module cache has 0555 directories; make them writable in order to remove content.
- afero.Walk(c.Fs, c.pruneAllRootDir, func(path string, info os.FileInfo, err error) error {
- if err != nil {
- return nil
- }
- if info.IsDir() {
- counter++
- c.Fs.Chmod(path, 0777)
- }
- return nil
- })
- return 1, c.Fs.RemoveAll(c.pruneAllRootDir)
+ return hugofs.MakeReadableAndRemoveAllModulePkgDir(c.Fs, c.pruneAllRootDir)
}