1
0
Fork 0
mirror of https://github.com/gohugoio/hugo.git synced 2025-04-11 10:43:53 +00:00

Simplify ExtractRootPaths

This commit is contained in:
Bjørn Erik Pedersen 2015-11-23 22:35:54 +01:00
parent c3931ef748
commit b00771ca14

View file

@ -458,13 +458,11 @@ func ExtractRootPaths(paths []string) []string {
r := make([]string, len(paths))
for i, p := range paths {
root := filepath.ToSlash(p)
if strings.Contains(root, "/") {
sections := strings.Split(root, "/")
for _, section := range sections {
if section != "" {
root = section
break
}
sections := strings.Split(root, "/")
for _, section := range sections {
if section != "" {
root = section
break
}
}
r[i] = root