Skip to content

Commit

Permalink
Skip not existing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
cabrador committed Aug 28, 2024
1 parent 4098ef3 commit 14a46ed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions utils/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package utils

import (
"errors"
"os"
"path/filepath"
"strings"
Expand All @@ -38,6 +39,11 @@ func GetDirectorySize(path string) (int64, error) {
var size int64
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
if err != nil {
// Carmen can have files which are present at the call of this func but are not present when walk happens.
// Hence, we ignore this error and file and continue with the rest of the files.
if errors.Is(err, os.ErrExist) {
return nil
}
return err
}
if !info.IsDir() {
Expand Down

0 comments on commit 14a46ed

Please sign in to comment.