From b757d264230d65f988e08158e096a09497d39eb4 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Wed, 3 Aug 2011 17:26:15 +0200 Subject: Imported Upstream version 2011.07.29 --- src/pkg/path/filepath/path.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/pkg/path/filepath/path.go') diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go index b181483ed..3d5b915c1 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 @@ -140,8 +140,8 @@ func SplitList(path string) []string { } // Split splits path immediately following the final Separator, -// partitioning it into a directory and a file name components. -// If there are no separators in path, Split returns an empty base +// separating it into a directory and file name component. +// If there is no Separator in path, Split returns an empty dir // and file set to path. func Split(path string) (dir, file string) { i := len(path) - 1 -- cgit v1.2.3