Improved Windows support
This commit is contained in:
parent
e818e5b907
commit
aedd6bf6a1
@ -1,3 +1,5 @@
|
||||
//go:build linux || darwin
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
|
22
src/fs/Walk_windows.go
Normal file
22
src/fs/Walk_windows.go
Normal file
@ -0,0 +1,22 @@
|
||||
//go:build windows
|
||||
|
||||
package fs
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Walk calls your callback function for every file name inside the directory.
|
||||
// It doesn't distinguish between files and directories.
|
||||
func Walk(directory string, callBack func(string)) error {
|
||||
return filepath.WalkDir(directory, func(path string, d fs.DirEntry, err error) error {
|
||||
if strings.HasPrefix(d.Name(), ".") {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
|
||||
callBack(path)
|
||||
return nil
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user