]> Cypherpunks repositories - gostls13.git/commitdiff
path/filepath: windows drive letter cannot be a digit
authorAlex Brainman <alex.brainman@gmail.com>
Fri, 23 Mar 2012 04:57:19 +0000 (15:57 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 23 Mar 2012 04:57:19 +0000 (15:57 +1100)
R=golang-dev, r
CC=golang-dev, mattn.jp
https://golang.org/cl/5885056

src/pkg/path/filepath/path_test.go
src/pkg/path/filepath/path_windows.go

index 87cb5e5530837b3d93ae02ff387f7b3f620399ee..2aba553d23efb274e3a4d5fc8eb36d21777768f7 100644 (file)
@@ -814,6 +814,7 @@ type VolumeNameTest struct {
 var volumenametests = []VolumeNameTest{
        {`c:/foo/bar`, `c:`},
        {`c:`, `c:`},
+       {`2:`, ``},
        {``, ``},
        {`\\\host`, ``},
        {`\\\host\`, ``},
index 1d1d23bfe7ccd8ff22f186e8babcc8a747794f3d..3dcd0302195d6bd58ba1c2a08d6b878dfa21d76e 100644 (file)
@@ -35,9 +35,7 @@ func VolumeName(path string) (v string) {
        }
        // with drive letter
        c := path[0]
-       if path[1] == ':' &&
-               ('0' <= c && c <= '9' || 'a' <= c && c <= 'z' ||
-                       'A' <= c && c <= 'Z') {
+       if path[1] == ':' && ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z') {
                return path[:2]
        }
        // is it UNC