blob: 4782dc061c757c60629bd500c4be82b04abbd4eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
}
|