diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-22 21:51:29 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-22 21:51:29 +0200 |
| commit | d88661935fa2b6e2c0fe93345800113e1a71b451 (patch) | |
| tree | 0002f1152a4eebafee6e3dea4065964a50d786c0 /crawl | |
| parent | deebd135ffcb1c167f12ecf2d4c0aebdc14cbc86 (diff) | |
docs
Diffstat (limited to 'crawl')
| -rw-r--r-- | crawl/crawl.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crawl/crawl.go b/crawl/crawl.go index fccd81d..cc3d16c 100644 --- a/crawl/crawl.go +++ b/crawl/crawl.go @@ -7,10 +7,12 @@ import ( "strings" ) +// Evaluated returns a path with evaluated symlinks func Evaluated(loc string) (string, error) { return filepath.EvalSymlinks(loc) } +// RichLocations combines the path and Evaluated path Locations func RichLocations(origin string) []string { locs := Locations(origin) @@ -24,6 +26,8 @@ func RichLocations(origin string) []string { return locs } +// Locations returns a slice of increasingly shorter file paths, +// losing a segment each time. func Locations(origin string) []string { origin = path.Clean(origin) var locs = []string{ @@ -40,6 +44,7 @@ func Locations(origin string) []string { return locs } +// ParentDir returns a path with the top element missing func ParentDir(origin string) string { trimmedOrigin := strings.TrimSuffix(origin, "/") dir, _ := path.Split(trimmedOrigin) |
