mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-12-26 10:47:54 +08:00
25 lines
394 B
Go
25 lines
394 B
Go
package master_ui
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
type Breadcrumb struct {
|
|
Name string
|
|
Link string
|
|
}
|
|
|
|
func ToBreadcrumb(fullpath string) (crumbs []Breadcrumb) {
|
|
parts := strings.Split(fullpath, "/")
|
|
|
|
for i := 0; i < len(parts); i++ {
|
|
crumbs = append(crumbs, Breadcrumb{
|
|
Name: parts[i] + "/",
|
|
Link: "/" + filepath.ToSlash(filepath.Join(parts[0:i+1]...)),
|
|
})
|
|
}
|
|
|
|
return
|
|
}
|