forked from navidrome/navidrome
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore Recycle Bins in Windows. Fix navidrome#1074
- Loading branch information
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) | ||
}) | ||
}) | ||
}) |