mirror of
https://github.com/golang/go
synced 2024-11-11 22:20:22 -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:
parent
d420be5b1c
commit
f39ff80bea
@ -814,6 +814,7 @@ type VolumeNameTest struct {
|
||||
var volumenametests = []VolumeNameTest{
|
||||
{`c:/foo/bar`, `c:`},
|
||||
{`c:`, `c:`},
|
||||
{`2:`, ``},
|
||||
{``, ``},
|
||||
{`\\\host`, ``},
|
||||
{`\\\host\`, ``},
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user