diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-06-30 15:34:22 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-06-30 15:34:22 +0200 |
commit | d39f5aa373a4422f7a5f3ee764fb0f6b0b719d61 (patch) | |
tree | 1833f8b72a4b3a8f00d0d143b079a8fcad01c6ae /src/pkg/path/filepath/path_windows.go | |
parent | 8652e6c371b8905498d3d314491d36c58d5f68d5 (diff) | |
download | golang-upstream/58.tar.gz |
Imported Upstream version 58upstream/58
Diffstat (limited to 'src/pkg/path/filepath/path_windows.go')
-rw-r--r-- | src/pkg/path/filepath/path_windows.go | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/pkg/path/filepath/path_windows.go b/src/pkg/path/filepath/path_windows.go index dbd1c1e40..35302eb1a 100644 --- a/src/pkg/path/filepath/path_windows.go +++ b/src/pkg/path/filepath/path_windows.go @@ -4,20 +4,11 @@ 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. @@ -28,7 +19,7 @@ func volumeName(path string) string { } // 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] |