mirror of
https://github.com/golang/go
synced 2024-11-17 22:05:02 -07:00
godoc: fix path problem for windows.
R=golang-dev, gri CC=golang-dev https://golang.org/cl/4299044
This commit is contained in:
parent
61c83b6407
commit
b22e29d9bf
@ -266,8 +266,8 @@ func (dir *Directory) lookupLocal(name string) *Directory {
|
||||
|
||||
// lookup looks for the *Directory for a given path, relative to dir.
|
||||
func (dir *Directory) lookup(path string) *Directory {
|
||||
d := strings.Split(dir.Path, "/", -1)
|
||||
p := strings.Split(path, "/", -1)
|
||||
d := strings.Split(dir.Path, string(filepath.Separator), -1)
|
||||
p := strings.Split(path, string(filepath.Separator), -1)
|
||||
i := 0
|
||||
for i < len(d) {
|
||||
if i >= len(p) || d[i] != p[i] {
|
||||
@ -342,8 +342,8 @@ func (root *Directory) listing(skipRoot bool) *DirList {
|
||||
if strings.HasPrefix(d.Path, root.Path) {
|
||||
path = d.Path[len(root.Path):]
|
||||
}
|
||||
// remove trailing '/' if any - path must be relative
|
||||
if len(path) > 0 && path[0] == '/' {
|
||||
// remove trailing separator if any - path must be relative
|
||||
if len(path) > 0 && filepath.IsAbs(path) {
|
||||
path = path[1:]
|
||||
}
|
||||
p.Path = path
|
||||
|
@ -222,6 +222,9 @@ func main() {
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
|
||||
// Clean goroot: normalize path separator.
|
||||
*goroot = filepath.Clean(*goroot)
|
||||
|
||||
// Check usage: either server and no args, or command line and args
|
||||
if (*httpAddr != "") != (flag.NArg() == 0) {
|
||||
usage()
|
||||
|
Loading…
Reference in New Issue
Block a user