2021-09-09 20:25:25 +08:00
|
|
|
//go:build windows
|
2015-02-07 23:49:09 +08:00
|
|
|
// +build windows
|
|
|
|
|
2022-08-28 19:21:57 +08:00
|
|
|
// Package driveletter returns whether a name is a valid drive letter
|
2018-01-13 00:30:54 +08:00
|
|
|
package driveletter
|
2015-02-07 23:49:09 +08:00
|
|
|
|
2018-01-13 00:30:54 +08:00
|
|
|
// IsDriveLetter returns a bool indicating whether name is a valid
|
2015-02-07 23:49:09 +08:00
|
|
|
// Windows drive letter
|
2018-01-13 00:30:54 +08:00
|
|
|
func IsDriveLetter(name string) bool {
|
2015-02-07 23:49:09 +08:00
|
|
|
if len(name) != 1 {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
c := name[0]
|
|
|
|
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
|
|
|
|
}
|