GetPath returns the full path to the driver module file. This method first perform a lookup in the opened/created driver modules. If the module is not found, then we enumerate all drivers and try to find the matching driver module path.
(driver string)
| 56 | // is not found, then we enumerate all drivers and try to find the matching |
| 57 | // driver module path. |
| 58 | func (d *DevPathResolver) GetPath(driver string) string { |
| 59 | path, ok := d.paths[strings.ToLower(driver)] |
| 60 | if ok { |
| 61 | return path |
| 62 | } |
| 63 | drivers := sys.EnumDevices() |
| 64 | for _, drv := range drivers { |
| 65 | if strings.EqualFold(strings.ToLower(filepath.Base(drv.Filename)), driver) { |
| 66 | return drv.Filename |
| 67 | } |
| 68 | } |
| 69 | return "" |
| 70 | } |
no test coverage detected