1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:44:40 -07:00

path/filepath: windows drive letter cannot be a digit

R=golang-dev, r
CC=golang-dev, mattn.jp
https://golang.org/cl/5885056
This commit is contained in:
Alex Brainman 2012-03-23 15:57:19 +11:00
parent d420be5b1c
commit f39ff80bea
2 changed files with 2 additions and 3 deletions

View File

@ -814,6 +814,7 @@ type VolumeNameTest struct {
var volumenametests = []VolumeNameTest{
{`c:/foo/bar`, `c:`},
{`c:`, `c:`},
{`2:`, ``},
{``, ``},
{`\\\host`, ``},
{`\\\host\`, ``},

View 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