diff --git a/pkg/files/curpath.go b/pkg/files/curpath.go new file mode 100644 index 0000000..1b59982 --- /dev/null +++ b/pkg/files/curpath.go @@ -0,0 +1,21 @@ +package files + +import ( + "net/url" + "strings" +) + +func CurrentPath(path string) (curPath string) { + parts := strings.Split(path, "/")[1:] + curPath = "root" + for i, part := range parts { + var sb strings.Builder + sb.WriteString("/") + sb.WriteString(url.PathEscape(part)) + sb.WriteString("") + curPath += sb.String() + } + return +}