env_unix.go\
        file_posix.go\
        file_unix.go\
+       path_unix.go\
        sys_bsd.go\
        exec_posix.go\
        exec_unix.go\
        env_unix.go\
        file_posix.go\
        file_unix.go\
+       path_unix.go\
        sys_bsd.go\
        exec_posix.go\
        exec_unix.go\
        env_unix.go\
        file_posix.go\
        file_unix.go\
+       path_unix.go\
        sys_linux.go\
        exec_posix.go\
        exec_unix.go\
        env_windows.go\
        file_posix.go\
        file_windows.go\
+       path_windows.go\
        sys_windows.go\
        exec_posix.go\
        exec_windows.go\
        error_plan9.go\
        env_plan9.go\
        file_plan9.go\
+       path_plan9.go\
        sys_plan9.go\
        exec_plan9.go\
 
 
 
        // Doesn't already exist; make sure parent does.
        i := len(path)
-       for i > 0 && path[i-1] == '/' { // Skip trailing slashes.
+       for i > 0 && IsPathSeparator(path[i-1]) { // Skip trailing path separator.
                i--
        }
 
        j := i
-       for j > 0 && path[j-1] != '/' { // Scan backward over element.
+       for j > 0 && !IsPathSeparator(path[j-1]) { // Scan backward over element.
                j--
        }
 
        for {
                names, err1 := fd.Readdirnames(100)
                for _, name := range names {
-                       err1 := RemoveAll(path + "/" + name)
+                       err1 := RemoveAll(path + string(PathSeparator) + name)
                        if err == nil {
                                err = err1
                        }
 
--- /dev/null
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package os
+
+const (
+       PathSeparator     = '/' // OS-specific path separator
+       PathListSeparator = 0   // OS-specific path list separator
+)
+
+// IsPathSeparator returns true if c is a directory separator character.
+func IsPathSeparator(c uint8) bool {
+       return PathSeparator == c
+}
 
 
 import (
        . "os"
+       "path/filepath"
        "testing"
        "runtime"
        "syscall"
        if !ok {
                t.Fatalf("MkdirAll %q returned %T, not *PathError", fpath, err)
        }
-       if perr.Path != fpath {
-               t.Fatalf("MkdirAll %q returned wrong error path: %q not %q", fpath, perr.Path, fpath)
+       if filepath.Clean(perr.Path) != filepath.Clean(fpath) {
+               t.Fatalf("MkdirAll %q returned wrong error path: %q not %q", fpath, filepath.Clean(perr.Path), filepath.Clean(fpath))
        }
 
        // Can't make subdirectory of file.
        if !ok {
                t.Fatalf("MkdirAll %q returned %T, not *PathError", ffpath, err)
        }
-       if perr.Path != fpath {
-               t.Fatalf("MkdirAll %q returned wrong error path: %q not %q", ffpath, perr.Path, fpath)
+       if filepath.Clean(perr.Path) != filepath.Clean(fpath) {
+               t.Fatalf("MkdirAll %q returned wrong error path: %q not %q", ffpath, filepath.Clean(perr.Path), filepath.Clean(fpath))
+       }
+
+       if syscall.OS == "windows" {
+               path := `_test\_TestMkdirAll_\dir\.\dir2\`
+               err := MkdirAll(path, 0777)
+               if err != nil {
+                       t.Fatalf("MkdirAll %q: %s", path, err)
+               }
        }
 }
 
 
--- /dev/null
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package os
+
+const (
+       PathSeparator     = '/' // OS-specific path separator
+       PathListSeparator = ':' // OS-specific path list separator
+)
+
+// IsPathSeparator returns true if c is a directory separator character.
+func IsPathSeparator(c uint8) bool {
+       return PathSeparator == c
+}
 
--- /dev/null
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package os
+
+const (
+       PathSeparator     = '\\' // OS-specific path separator
+       PathListSeparator = ':'  // OS-specific path list separator
+)
+
+// IsPathSeparator returns true if c is a directory separator character.
+func IsPathSeparator(c uint8) bool {
+       // NOTE: Windows accept / as path separator.
+       return c == '\\' || c == '/'
+}
 
 )
 
 const (
+       Separator           = os.PathSeparator
+       ListSeparator       = os.PathListSeparator
        SeparatorString     = string(Separator)
        ListSeparatorString = string(ListSeparator)
 )
 
        for r < n {
                switch {
-               case isSeparator(path[r]):
+               case os.IsPathSeparator(path[r]):
                        // empty path element
                        r++
-               case path[r] == '.' && (r+1 == n || isSeparator(path[r+1])):
+               case path[r] == '.' && (r+1 == n || os.IsPathSeparator(path[r+1])):
                        // . element
                        r++
-               case path[r] == '.' && path[r+1] == '.' && (r+2 == n || isSeparator(path[r+2])):
+               case path[r] == '.' && path[r+1] == '.' && (r+2 == n || os.IsPathSeparator(path[r+2])):
                        // .. element: remove to last separator
                        r += 2
                        switch {
                        case w > dotdot:
                                // can backtrack
                                w--
-                               for w > dotdot && !isSeparator(buf[w]) {
+                               for w > dotdot && !os.IsPathSeparator(buf[w]) {
                                        w--
                                }
                        case !rooted:
                                w++
                        }
                        // copy element
-                       for ; r < n && !isSeparator(path[r]); r++ {
+                       for ; r < n && !os.IsPathSeparator(path[r]); r++ {
                                buf[w] = path[r]
                                w++
                        }
 // and file set to path.
 func Split(path string) (dir, file string) {
        i := len(path) - 1
-       for i >= 0 && !isSeparator(path[i]) {
+       for i >= 0 && !os.IsPathSeparator(path[i]) {
                i--
        }
        return path[:i+1], path[i+1:]
 // in the final element of path; it is empty if there is
 // no dot.
 func Ext(path string) string {
-       for i := len(path) - 1; i >= 0 && !isSeparator(path[i]); i-- {
+       for i := len(path) - 1; i >= 0 && !os.IsPathSeparator(path[i]); i-- {
                if path[i] == '.' {
                        return path[i:]
                }
                return "."
        }
        // Strip trailing slashes.
-       for len(path) > 0 && isSeparator(path[len(path)-1]) {
+       for len(path) > 0 && os.IsPathSeparator(path[len(path)-1]) {
                path = path[0 : len(path)-1]
        }
        // Find the last element
        i := len(path) - 1
-       for i >= 0 && !isSeparator(path[i]) {
+       for i >= 0 && !os.IsPathSeparator(path[i]) {
                i--
        }
        if i >= 0 {
 
 
 import "strings"
 
-const (
-       Separator     = '/' // OS-specific path separator
-       ListSeparator = 0   // OS-specific path list separator
-)
-
-// isSeparator returns true if c is a directory separator character.
-func isSeparator(c uint8) bool {
-       return Separator == c
-}
-
 // IsAbs returns true if the path is absolute.
 func IsAbs(path string) bool {
        return strings.HasPrefix(path, "/") || strings.HasPrefix(path, "#")
 
 
 import "strings"
 
-const (
-       Separator     = '/' // OS-specific path separator
-       ListSeparator = ':' // OS-specific path list separator
-)
-
-// isSeparator returns true if c is a directory separator character.
-func isSeparator(c uint8) bool {
-       return Separator == c
-}
-
 // IsAbs returns true if the path is absolute.
 func IsAbs(path string) bool {
        return strings.HasPrefix(path, "/")
 
 
 package filepath
 
-const (
-       Separator     = '\\' // OS-specific path separator
-       ListSeparator = ':'  // OS-specific path list separator
-)
-
-// isSeparator returns true if c is a directory separator character.
-func isSeparator(c uint8) bool {
-       // NOTE: Windows accept / as path separator.
-       return c == '\\' || c == '/'
-}
+import "os"
 
 // IsAbs returns true if the path is absolute.
 func IsAbs(path string) bool {
-       return path != "" && (volumeName(path) != "" || isSeparator(path[0]))
+       return path != "" && (volumeName(path) != "" || os.IsPathSeparator(path[0]))
 }
 
 // volumeName return leading volume name.  
        }
        // with drive letter
        c := path[0]
-       if len(path) > 2 && path[1] == ':' && isSeparator(path[2]) &&
+       if len(path) > 2 && path[1] == ':' && os.IsPathSeparator(path[2]) &&
                ('0' <= c && c <= '9' || 'a' <= c && c <= 'z' ||
                        'A' <= c && c <= 'Z') {
                return path[0:2]