diff options
Diffstat (limited to 'src/pkg/path/filepath/path.go')
| -rw-r--r-- | src/pkg/path/filepath/path.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go index a5e6a22ae9..28ad676c25 100644 --- a/src/pkg/path/filepath/path.go +++ b/src/pkg/path/filepath/path.go @@ -38,19 +38,19 @@ const ( // Getting Dot-Dot right,'' // http://plan9.bell-labs.com/sys/doc/lexnames.html func Clean(path string) string { + vol := volumeName(path) + path = path[len(vol):] if path == "" { - return "." + return vol + "." } - rooted := IsAbs(path) + rooted := os.IsPathSeparator(path[0]) // Invariants: // reading from path; r is index of next byte to process. // writing to buf; w is index of next byte to write. // dotdot is index in buf where .. must stop, either because // it is the leading slash or it is a leading ../../.. prefix. - prefix := volumeName(path) - path = path[len(prefix):] n := len(path) buf := []byte(path) r, w, dotdot := 0, 0, 0 @@ -110,7 +110,7 @@ func Clean(path string) string { w++ } - return prefix + string(buf[0:w]) + return FromSlash(vol + string(buf[0:w])) } // ToSlash returns the result of replacing each separator character |
