MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / demonstrably_missing

Function demonstrably_missing

atomic-cli/src/commands/diagnostics/collect.rs:329–346  ·  view source on GitHub ↗

A dangling symlink or a concurrent replacement is not proof of absence.

(path: &Path)

Source from the content-addressed store, hash-verified

327
328// A dangling symlink or a concurrent replacement is not proof of absence.
329fn demonstrably_missing(path: &Path) -> bool {
330 match std::fs::symlink_metadata(path) {
331 Ok(_) => return false,
332 Err(error) if error.kind() == ErrorKind::NotFound => {}
333 Err(_) => return false,
334 }
335 for ancestor in path.ancestors().skip(1) {
336 match std::fs::symlink_metadata(ancestor) {
337 Ok(metadata) if metadata.file_type().is_symlink() => {
338 return std::fs::metadata(ancestor).is_ok();
339 }
340 Ok(_) => return true,
341 Err(error) if error.kind() == ErrorKind::NotFound => {}
342 Err(_) => return false,
343 }
344 }
345 false
346}
347
348impl Sources {
349 pub(crate) fn from_process() -> Self {

Callers 7

inspect_linked_gitFunction · 0.85
read_receiptFunction · 0.85
settings_hooksFunction · 0.85
read_skills_packageFunction · 0.85
read_shim_configFunction · 0.85

Calls 2

skipMethod · 0.80
kindMethod · 0.45

Tested by

no test coverage detected