aboutsummaryrefslogtreecommitdiff
path: root/internal/scanner/walker.go
diff options
context:
space:
mode:
authorRanXom <saiyedshizain@gmail.com>2026-07-12 23:11:32 +0530
committerRanXom <saiyedshizain@gmail.com>2026-07-12 23:11:32 +0530
commitca40035398c16abfc78a14e52e3f8640f4eac37c (patch)
treed5c736e39974c908b493845591c3b42019323105 /internal/scanner/walker.go
parent1ae0b97b73e6ffb1303bcf9043a7d28d158ad791 (diff)
downloadgalleryd-ca40035398c16abfc78a14e52e3f8640f4eac37c.tar.xz
galleryd-ca40035398c16abfc78a14e52e3f8640f4eac37c.zip
feat(scanner): skip hidden directories
fix(code): fix misc. code in scanner and walker
Diffstat (limited to 'internal/scanner/walker.go')
-rw-r--r--internal/scanner/walker.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/scanner/walker.go b/internal/scanner/walker.go
index c1de97a..ad37679 100644
--- a/internal/scanner/walker.go
+++ b/internal/scanner/walker.go
@@ -6,10 +6,10 @@ import (
"path/filepath"
)
-func (s* Scanner) walk(ctx context.Context, root string) ([]File, error) {
+func (s *Scanner) walk(ctx context.Context, root string) ([]File, error) {
files := make([]File, 0)
- err := filepath:WalkDir(root, func(path string, d fs.DirEntry, err error) error {
+ err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error {
select {
case <-ctx.Done():
return ctx.Err()
@@ -21,6 +21,10 @@ func (s* Scanner) walk(ctx context.Context, root string) ([]File, error) {
}
if d.IsDir() {
+ if shouldSkipDir(d.Name()) {
+ return filepath.SkipDir
+ }
+
return nil
}
@@ -28,11 +32,7 @@ func (s* Scanner) walk(ctx context.Context, root string) ([]File, error) {
return nil
}
- info, err != nil {
- return err
- }
-
- rel, err := d.Info()
+ info, err := d.Info()
if err != nil {
return err
}