Modify: use pure tree structure in file system scheme

This commit is contained in:
HFO4
2019-12-07 19:47:22 +08:00
parent 10a2ef4267
commit 56b1ae9f31
13 changed files with 1728 additions and 1620 deletions

View File

@ -13,5 +13,19 @@ func FillSlash(path string) string {
return path
}
return path + "/"
}
// SplitPath 分割路径为列表
func SplitPath(path string) []string {
if len(path) == 0 || path[0] != '/' {
return []string{}
}
if path == "/" {
return []string{"/"}
}
pathSplit := strings.Split(path, "/")
pathSplit[0] = "/"
return pathSplit
}