mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
25 lines
376 B
Go
25 lines
376 B
Go
|
package master_ui
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
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.Join(parts[0:i+1]...),
|
||
|
})
|
||
|
}
|
||
|
|
||
|
return
|
||
|
}
|