Deduplicate WSL driverstore paths

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-02-21 11:48:56 +02:00
parent 882fbb3209
commit 35fc57291f

View File

@ -49,9 +49,15 @@ func Shutdown() error {
// GetDriverStorePaths returns the list of driver store paths // GetDriverStorePaths returns the list of driver store paths
func GetDriverStorePaths() []string { func GetDriverStorePaths() []string {
var paths []string var paths []string
selected := make(map[string]bool)
for i := 0; i < dxcore.getAdapterCount(); i++ { for i := 0; i < dxcore.getAdapterCount(); i++ {
adapter := dxcore.getAdapter(i) path := dxcore.getAdapter(i).getDriverStorePath()
paths = append(paths, adapter.getDriverStorePath()) if selected[path] {
continue
}
selected[path] = true
paths = append(paths, path)
} }
return paths return paths