21 lines
410 B
Go
21 lines
410 B
Go
package files
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func CurrentPath(path string) (curPath string) {
|
|
parts := strings.Split(path, "/")[1:]
|
|
curPath = "<a href=\"/\">root</a>"
|
|
for i, part := range parts {
|
|
var sb strings.Builder
|
|
sb.WriteString("/<a href=\"/")
|
|
sb.WriteString(strings.Join(parts[:i+1], "/"))
|
|
sb.WriteString("/\">")
|
|
sb.WriteString(part)
|
|
sb.WriteString("</a>")
|
|
curPath += sb.String()
|
|
}
|
|
return
|
|
}
|