-
Notifications
You must be signed in to change notification settings - Fork 0
/
filepath.go
18 lines (15 loc) · 894 Bytes
/
filepath.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Package filepathmust is a must-style wrapper over the standard library filepath package.
// All functions panic in response to any errors encountered.
package filepathmust
import (
"io/fs"
"path/filepath"
"github.com/mdwhatcott/must/must"
)
func Abs(path string) string { return must.Value(filepath.Abs(path)) }
func EvalSymlinks(path string) string { return must.Value(filepath.EvalSymlinks(path)) }
func Glob(pattern string) []string { return must.Value(filepath.Glob(pattern)) }
func Match(pattern, name string) bool { return must.Value(filepath.Match(pattern, name)) }
func Rel(basepath, targpath string) string { return must.Value(filepath.Rel(basepath, targpath)) }
func Walk(root string, fn filepath.WalkFunc) { must.Nada(filepath.Walk(root, fn)) }
func WalkDir(root string, fn fs.WalkDirFunc) { must.Nada(filepath.WalkDir(root, fn)) }