Improved Windows support

This commit is contained in:
Eduard Urbach 2024-08-13 19:56:25 +02:00
parent e818e5b907
commit aedd6bf6a1
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,5 @@
//go:build linux || darwin
package fs
import (

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
})
}