Documentation ¶
Overview ¶
Package fspath is similar to the standard path package but provides functions that are more useful for path manipulation in the presence of symbolic links.
Index ¶
- func AppendClean(buf []byte, path string) []byte
- func Clean(path string) string
- func Depth(path string) (depth int)
- func HasTrailingSlash(s string) bool
- func IndexSlash(path string) int
- func IsAbs(path string) bool
- func IsRoot(path string) bool
- func Join(dir, name string) string
- func TrimLeadingSlash(s string) string
- func TrimTrailingSlash(s string) string
- func Walk(path string) (elem, name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendClean ¶
AppendClean is like cleanPath but it appends the result to the byte slice passed as first argument.
func Clean ¶
Clean is like path.Clean but it preserves parent directory references; this is necessary to ensure that symbolic links aren't erased from walking the path.
func HasTrailingSlash ¶
func IndexSlash ¶
IndexSlash is like strings.IndexByte(path, '/') but the function is simple enough to be inlined, which is a measurable improvement since it gets called very often by the other routines in this file.
func IsAbs ¶
IsAbs returns true if the path is absolute, which means that it starts with a slash ("/").
func IsRoot ¶ added in v0.1.1
IsRoot returns true if the path represents a root directory, which means that it is absolute and composed only of sequences of "/", ".", and "..".
func Join ¶
Join is similar to path.Join but is simplified to only join two paths and avoid cleaning parent directory references in the paths.
func TrimLeadingSlash ¶
func TrimTrailingSlash ¶
Types ¶
This section is empty.