aboutsummaryrefslogtreecommitdiff
path: root/pkg/u/file.go
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-07-01 23:32:54 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-07-01 23:32:54 +0200
commit1b1460c8d4fa358433c51fd5293fd1c79f32aeff (patch)
treeb87528374798941a89e07ead5b92c2842deb40b6 /pkg/u/file.go
parent8f9853c8e26ffbad74e6414cec31104281a3860b (diff)
downloadcerrado-0.0.9.tar.gz
cerrado-0.0.9.tar.bz2
cerrado-0.0.9.zip
feat: Add pathing to the tree tabv0.0.9
Diffstat (limited to 'pkg/u/file.go')
-rw-r--r--pkg/u/file.go21
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)
+}