mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-05 05:27:37 +03:00
Ignore Recycle Bins in Windows. Fix #1074
This commit is contained in:
parent
47f15ccbc3
commit
339a6239fd
3 changed files with 46 additions and 2 deletions
35
scanner/walk_dir_tree_windows_test.go
Normal file
35
scanner/walk_dir_tree_windows_test.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package scanner
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("walk_dir_tree_windows", func() {
|
||||
baseDir := filepath.Join("tests", "fixtures")
|
||||
|
||||
Describe("isDirIgnored", func() {
|
||||
It("returns false for normal dirs", func() {
|
||||
dirEntry, _ := getDirEntry(baseDir, "empty_folder")
|
||||
Expect(isDirIgnored(baseDir, dirEntry)).To(BeFalse())
|
||||
})
|
||||
It("returns true when folder contains .ndignore file", func() {
|
||||
dirEntry, _ := getDirEntry(baseDir, "ignored_folder")
|
||||
Expect(isDirIgnored(baseDir, dirEntry)).To(BeTrue())
|
||||
})
|
||||
It("returns true when folder name starts with a `.`", func() {
|
||||
dirEntry, _ := getDirEntry(baseDir, ".hidden_folder")
|
||||
Expect(isDirIgnored(baseDir, dirEntry)).To(BeTrue())
|
||||
})
|
||||
It("returns false when folder name starts with ellipses", func() {
|
||||
dirEntry, _ := getDirEntry(baseDir, "...unhidden_folder")
|
||||
Expect(isDirIgnored(baseDir, dirEntry)).To(BeFalse())
|
||||
})
|
||||
It("returns true when folder name is $Recycle.Bin", func() {
|
||||
dirEntry, _ := getDirEntry(baseDir, "$Recycle.Bin")
|
||||
Expect(isDirIgnored(baseDir, dirEntry)).To(BeTrue())
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue