diff --git a/pkg/nvcdi/driver-wsl.go b/pkg/nvcdi/driver-wsl.go index e382cb9d..944ed08a 100644 --- a/pkg/nvcdi/driver-wsl.go +++ b/pkg/nvcdi/driver-wsl.go @@ -54,24 +54,16 @@ func newWSLDriverDiscoverer(logger logger.Interface, driverRoot string, hookCrea if len(driverStorePaths) == 0 { return nil, fmt.Errorf("no driver store paths found") } + if len(driverStorePaths) > 1 { + logger.Warningf("Found multiple driver store paths: %v", driverStorePaths) + } logger.Infof("Using WSL driver store paths: %v", driverStorePaths) return newWSLDriverStoreDiscoverer(logger, driverRoot, hookCreator, ldconfigPath, driverStorePaths) } // newWSLDriverStoreDiscoverer returns a Discoverer for WSL2 drivers in the driver store associated with a dxcore adapter. -func newWSLDriverStoreDiscoverer(logger logger.Interface, driverRoot string, hookCreator discover.HookCreator, ldconfigPath string, driverStorePaths []string) (discover.Discover, error) { - var searchPaths []string - seen := make(map[string]bool) - for _, path := range driverStorePaths { - if seen[path] { - continue - } - searchPaths = append(searchPaths, path) - } - if len(searchPaths) > 1 { - logger.Warningf("Found multiple driver store paths: %v", searchPaths) - } +func newWSLDriverStoreDiscoverer(logger logger.Interface, driverRoot string, hookCreator discover.HookCreator, ldconfigPath string, searchPaths []string) (discover.Discover, error) { searchPaths = append(searchPaths, "/usr/lib/wsl/lib") libraries := discover.NewMounts(