From 643b89e53947293be675302074fb17eeb23c6239 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 22 Nov 2023 21:57:03 +0100 Subject: [PATCH] Add driver.Config Signed-off-by: Evan Lezar --- internal/discover/graphics.go | 12 ++---------- internal/lookup/root/root.go | 9 +++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/internal/discover/graphics.go b/internal/discover/graphics.go index 0a8ff8d2..35b51982 100644 --- a/internal/discover/graphics.go +++ b/internal/discover/graphics.go @@ -61,11 +61,7 @@ func NewGraphicsMountsDiscoverer(logger logger.Interface, driver *root.Driver, n jsonMounts := NewMounts( logger, - lookup.NewFileLocator( - lookup.WithLogger(logger), - lookup.WithRoot(driver.Root), - lookup.WithSearchPaths("/etc", "/usr/share"), - ), + driver.Configs(), driver.Root, []string{ "glvnd/egl_vendor.d/10_nvidia.json", @@ -292,11 +288,7 @@ func newXorgDiscoverer(logger logger.Interface, driver *root.Driver, nvidiaCTKPa xorgConfig := NewMounts( logger, - lookup.NewFileLocator( - lookup.WithLogger(logger), - lookup.WithRoot(driver.Root), - lookup.WithSearchPaths("/usr/share"), - ), + driver.Configs(), driver.Root, []string{"X11/xorg.conf.d/10-nvidia.conf"}, ) diff --git a/internal/lookup/root/root.go b/internal/lookup/root/root.go index 82ea7cb5..89754618 100644 --- a/internal/lookup/root/root.go +++ b/internal/lookup/root/root.go @@ -53,6 +53,15 @@ func (r *Driver) Libraries() lookup.Locator { ) } +// Configs returns a locator for driver configs. +func (r *Driver) Configs() lookup.Locator { + return lookup.NewFileLocator( + lookup.WithLogger(r.logger), + lookup.WithRoot(r.Root), + lookup.WithSearchPaths("/etc", "/usr/share"), + ) +} + // normalizeSearchPaths takes a list of paths and normalized these. // Each of the elements in the list is expanded if it is a path list and the // resultant list is returned.