todo
This commit is contained in:
parent
6b4240ac0a
commit
a32f5b55f9
17
main_test.go
17
main_test.go
|
@ -36,15 +36,26 @@ type Node struct {
|
||||||
// return string(path)
|
// return string(path)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func xPath(spath string) string {
|
func xPath(spath string) {
|
||||||
var path []byte = make([]byte, len(spath))
|
var path []byte = make([]byte, len(spath)+1)
|
||||||
copy(path, spath)
|
copy(path, spath)
|
||||||
|
|
||||||
for i := 0; i < len(path); i++ {
|
root := &Node{}
|
||||||
|
cur := root
|
||||||
|
|
||||||
|
for i := 0; i < len(spath); i++ {
|
||||||
c := path[i]
|
c := path[i]
|
||||||
if c == '/' {
|
if c == '/' {
|
||||||
|
if path[i+1] == '/' {
|
||||||
|
cur.Type = TypeAllChildren
|
||||||
|
} else {
|
||||||
|
cur.Type = TypeChild
|
||||||
|
}
|
||||||
|
|
||||||
|
cur.Next = &Node{Next: cur}
|
||||||
|
cur = cur.Next
|
||||||
}
|
}
|
||||||
|
cur.Name = append(cur.Name, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user