diff options
Diffstat (limited to 'pkg/u/file.go')
-rw-r--r-- | pkg/u/file.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/u/file.go b/pkg/u/file.go index cf86c75..fafe0fb 100644 --- a/pkg/u/file.go +++ b/pkg/u/file.go @@ -4,6 +4,7 @@ import ( "errors" "log/slog" "os" + "path/filepath" ) func FileExist(filename string) bool { @@ -19,3 +20,23 @@ func FileExist(filename string) bool { return false } } + +// This is just a slin wraper to make easier to compose path in the template +type Pathing string + +func Root() Pathing { + return "/" +} + +func (s Pathing) AddPath(p string) Pathing { + return Pathing(filepath.Join(string(s), p)) +} + +func (s Pathing) AddPaths(p []string) Pathing { + f := filepath.Join(p...) + return Pathing(filepath.Join(string(s), f)) +} + +func (s Pathing) Done() string { + return string(s) +} |