Like path.Join, but preserves trailing slash..
(elem ...string)
| 79 | |
| 80 | // Like path.Join, but preserves trailing slash.. |
| 81 | func pathJoin(elem ...string) string { |
| 82 | if len(elem) == 0 { |
| 83 | return "" |
| 84 | } |
| 85 | hadSlash := strings.HasSuffix(elem[len(elem)-1], "/") |
| 86 | p := path.Join(elem...) |
| 87 | if hadSlash { |
| 88 | p += "/" |
| 89 | } |
| 90 | return p |
| 91 | } |
| 92 | |
| 93 | // pathClean works like path.Clean but will always preserve a trailing slash. |
| 94 | func pathClean(p string) string { |
no outgoing calls