Improved Windows support

This commit is contained in:
Eduard Urbach 2024-08-13 19:56:25 +02:00
parent 33da0cc315
commit 124a48d2c8
Signed by: eduard
GPG key ID: 49226B848C78F6C8
2 changed files with 24 additions and 0 deletions

22
src/fs/Walk_windows.go Normal file
View 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
})
}