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