diff options
Diffstat (limited to 'libgo/go/path/filepath/path_windows.go')
-rw-r--r-- | libgo/go/path/filepath/path_windows.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libgo/go/path/filepath/path_windows.go b/libgo/go/path/filepath/path_windows.go index 41c57df7386..0d8b62015c5 100644 --- a/libgo/go/path/filepath/path_windows.go +++ b/libgo/go/path/filepath/path_windows.go @@ -37,7 +37,7 @@ func volumeNameLen(path string) int { if path[1] == ':' && ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z') { return 2 } - // is it UNC + // is it UNC? https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx if l := len(path); l >= 5 && isSlash(path[0]) && isSlash(path[1]) && !isSlash(path[2]) && path[2] != '.' { // first, leading `\\` and next shouldn't be `\`. its server name. @@ -65,6 +65,9 @@ func volumeNameLen(path string) int { } // HasPrefix exists for historical compatibility and should not be used. +// +// Deprecated: HasPrefix does not respect path boundaries and +// does not ignore case when required. func HasPrefix(p, prefix string) bool { if strings.HasPrefix(p, prefix) { return true @@ -106,7 +109,11 @@ func splitList(path string) []string { } func abs(path string) (string, error) { - return syscall.FullPath(path) + fullPath, err := syscall.FullPath(path) + if err != nil { + return "", err + } + return Clean(fullPath), nil } func join(elem []string) string { |