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

Function profile_source_paths

crates/openshell-cli/src/run.rs:5469–5489  ·  view source on GitHub ↗
(file: Option<&Path>, from: Option<&Path>)

Source from the content-addressed store, hash-verified

5467}
5468
5469fn profile_source_paths(file: Option<&Path>, from: Option<&Path>) -> Result<Vec<PathBuf>> {
5470 if let Some(file) = file {
5471 return Ok(vec![file.to_path_buf()]);
5472 }
5473 let Some(from) = from else {
5474 return Ok(Vec::new());
5475 };
5476 let mut paths = Vec::new();
5477 for entry in std::fs::read_dir(from)
5478 .into_diagnostic()
5479 .wrap_err_with(|| format!("failed to read profile directory {}", from.display()))?
5480 {
5481 let entry = entry.into_diagnostic()?;
5482 let path = entry.path();
5483 if path.is_file() && profile_extension_supported(&path) {
5484 paths.push(path);
5485 }
5486 }
5487 paths.sort();
5488 Ok(paths)
5489}
5490
5491fn profile_extension_supported(path: &Path) -> bool {
5492 matches!(

Callers 1

Calls 3

pathMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected