|
|
@ -1,6 +1,8 @@
|
|
|
|
package maps
|
|
|
|
package maps
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"io/fs"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"sort"
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
|
|
|
@ -26,3 +28,14 @@ func Keys[T any](m map[string]T) []string {
|
|
|
|
func CleanPaths(paths []string) []string {
|
|
|
|
func CleanPaths(paths []string) []string {
|
|
|
|
return fn.Map(paths, func(i string) string { return filepath.Clean(i) })
|
|
|
|
return fn.Map(paths, func(i string) string { return filepath.Clean(i) })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MarkDirs will add an os.PathSeparator to the end of the name if the
|
|
|
|
|
|
|
|
// fs.DirEntry is a directory.
|
|
|
|
|
|
|
|
func MarkDirs(entries []fs.DirEntry) []string {
|
|
|
|
|
|
|
|
return fn.Map(entries, func(f fs.DirEntry) string {
|
|
|
|
|
|
|
|
if f.IsDir() {
|
|
|
|
|
|
|
|
return f.Name() + string(os.PathSeparator)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return f.Name()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|