MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / resolve_driver_search_dirs

Function resolve_driver_search_dirs

crates/openshell-server/src/compute/vm.rs:227–246  ·  view source on GitHub ↗
(vm_config: &VmComputeConfig)

Source from the content-addressed store, hash-verified

225}
226
227fn resolve_driver_search_dirs(vm_config: &VmComputeConfig) -> Vec<PathBuf> {
228 vm_config.driver_dir.clone().map_or_else(
229 || {
230 let mut dirs = Vec::new();
231 if let Ok(current_exe) = std::env::current_exe()
232 && let Some(prefix) = current_exe.parent().and_then(Path::parent)
233 {
234 push_unique_path(&mut dirs, prefix.join("libexec"));
235 push_unique_path(&mut dirs, prefix.join("libexec").join("openshell"));
236 }
237 for dir in VmComputeConfig::default_driver_search_dirs(
238 std::env::var_os("HOME").map(PathBuf::from),
239 ) {
240 push_unique_path(&mut dirs, dir);
241 }
242 dirs
243 },
244 |dir| vec![dir],
245 )
246}
247
248fn push_unique_path(paths: &mut Vec<PathBuf>, path: PathBuf) {
249 if !paths.iter().any(|existing| existing == &path) {

Calls 1

push_unique_pathFunction · 0.85