Delay the creation of cache directories until they're used

Fixes #11390
This commit is contained in:
Bjørn Erik Pedersen
2023-08-30 11:05:15 +02:00
parent c3f273b2d7
commit 94fbab2a88
3 changed files with 46 additions and 4 deletions

View File

@@ -53,6 +53,9 @@ func (c *Cache) Prune(force bool) (int, error) {
if c.pruneAllRootDir != "" {
return c.pruneRootDir(force)
}
if err := c.init(); err != nil {
return 0, err
}
counter := 0
@@ -117,6 +120,9 @@ func (c *Cache) Prune(force bool) (int, error) {
}
func (c *Cache) pruneRootDir(force bool) (int, error) {
if err := c.init(); err != nil {
return 0, err
}
info, err := c.Fs.Stat(c.pruneAllRootDir)
if err != nil {
if herrors.IsNotExist(err) {