Documentation
¶
Index ¶
- Constants
- func Exist(name string) bool
- func GlobFunc(pattern string, handler func(name string) bool) (matches []string, err error)
- func Pathify(path string) string
- func ResolveReference(path_, frombasepath, tobasepath string) string
- func ToDir(path string) string
- func TouchAll(path string, perm os.FileMode) error
- func WalkGlob(pattern string, fn WalkGlobFunc) error
- type WalkGlobFunc
Constants ¶
const ( // PrivateFileMode grants owner to read/write a file. PrivateFileMode = 0600 // PrivateDirMode grants owner to make/remove files inside the directory. PrivateDirMode = 0700 )
Variables ¶
This section is empty.
Functions ¶
func Exist ¶
Exist returns a boolean indicating whether the file is known to report that a file or directory does exist.
func GlobFunc ¶
GlobFunc returns the names of all files matching pattern satisfying f(c) or nil if there is no matching file. The syntax of patterns is the same as in Match. The pattern may describe hierarchical names such as /usr/*/bin/ed (assuming the Separator is '/').
Glob ignores file system errors such as I/O errors reading directories. The only possible returned error is ErrBadPattern, when pattern is malformed.
func ResolveReference ¶
ResolveReference resolves a path reference to a target base path from a base path. If path_ is not under frombasepath, then ResolveReference ignores frombasepath and return a path under tobasepath.
func WalkGlob ¶ added in v1.2.100
func WalkGlob(pattern string, fn WalkGlobFunc) error
WalkGlob returns the names of all files matching pattern satisfying f(c) or nil if there is no matching file. The syntax of patterns is the same as in Match. The pattern may describe hierarchical names such as /usr/*/bin/ed (assuming the Separator is '/').
Glob ignores file system errors such as I/O errors reading directories. The only possible returned error is ErrBadPattern, when pattern is malformed.
Types ¶
type WalkGlobFunc ¶ added in v1.2.100
WalkGlobFunc is the type of the function called by WalkGlob to visit all files matching pattern.
The error result returned by the function controls how WalkGlob continues. If the function returns the special value filepath.SkipAll, WalkGlob skips all files matching pattern satisfying f(c). Otherwise, if the function returns a non-nil error, WalkGlob stops entirely and returns that error.