GetLogicalDrives returns available device drive letters in the system.
()
| 67 | |
| 68 | // GetLogicalDrives returns available device drive letters in the system. |
| 69 | func GetLogicalDrives() []string { |
| 70 | bitmask, err := windows.GetLogicalDrives() |
| 71 | if err != nil { |
| 72 | return nil |
| 73 | } |
| 74 | devs := make([]string, 0) |
| 75 | for _, drive := range drives { |
| 76 | if bitmask&1 == 1 { |
| 77 | devs = append(devs, drive+":") |
| 78 | } |
| 79 | bitmask >>= 1 |
| 80 | } |
| 81 | return devs |
| 82 | } |
| 83 | |
| 84 | // QueryDosDevice translates the DOS device name to hard disk drive letter. |
| 85 | func QueryDosDevice(drive string) (string, error) { |