summaryrefslogtreecommitdiff
path: root/internal/tui/dashboard/pathlabel.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/dashboard/pathlabel.go')
-rw-r--r--internal/tui/dashboard/pathlabel.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/tui/dashboard/pathlabel.go b/internal/tui/dashboard/pathlabel.go
new file mode 100644
index 0000000..4782dc0
--- /dev/null
+++ b/internal/tui/dashboard/pathlabel.go
@@ -0,0 +1,17 @@
+package dashboard
+
+import (
+ "path/filepath"
+ "strings"
+)
+
+func rootPathLabelFromFSPath(path string) string {
+ cleaned := filepath.ToSlash(filepath.Clean(strings.TrimSpace(path)))
+ if cleaned == "" || cleaned == "." || cleaned == "/" {
+ return "root"
+ }
+ if strings.HasPrefix(cleaned, "/") {
+ return "root" + cleaned
+ }
+ return "root/" + cleaned
+}