Small optimizations for os.go (#1829)

* Small optimizations for os.go

* Cleanup isHidden check further
This commit is contained in:
David Pedersen authored and GitHub committed 2024-11-03 21:11:00 +11:00
1 parent 4408f37a9b
commit f5a0e655a1
2 files changed
+15 -22

No files matched your search

+6 -9
View File
@@ -189,31 +189,28 @@ func isHidden(f os.FileInfo, path string, hiddenfiles []string) bool {
hidden := false
for _, pattern := range hiddenfiles {
matched := matchPattern(strings.TrimPrefix(pattern, "!"), f.Name(), path)
if strings.HasPrefix(pattern, "!") && matched {
hidden = false
} else if matched {
hidden = true
if matchPattern(strings.TrimPrefix(pattern, "!"), f.Name(), path) {
hidden = !strings.HasPrefix(pattern, "!")
}
}
return hidden
}
func userName(f os.FileInfo) string {
func userName(_ os.FileInfo) string {
return ""
}
func groupName(f os.FileInfo) string {
func groupName(_ os.FileInfo) string {
return ""
}
func linkCount(f os.FileInfo) string {
func linkCount(_ os.FileInfo) string {
return ""
}
func errCrossDevice(err error) bool {
return err.(*os.LinkError).Err.(windows.Errno) == 17
return err.(*os.LinkError).Err.(windows.Errno) == windows.ERROR_NOT_SAME_DEVICE
}
func quoteString(s string) string {