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

Method list_directory_contents

atomic-core/src/output/memory.rs:463–482  ·  view source on GitHub ↗
(&self, path: &str)

Source from the content-addressed store, hash-verified

461 /// Get entries within a directory.
462 #[allow(dead_code)]
463 fn list_directory_contents(&self, path: &str) -> Vec<String> {
464 let files = self.files.borrow();
465 let prefix = if path.is_empty() {
466 String::new()
467 } else {
468 format!("{}/", path)
469 };
470
471 files
472 .keys()
473 .filter(|p| {
474 if prefix.is_empty() {
475 !p.contains('/')
476 } else {
477 p.starts_with(&prefix) && !p[prefix.len()..].contains('/')
478 }
479 })
480 .cloned()
481 .collect()
482 }
483}
484
485impl Default for Memory {

Callers 1

Calls 3

is_emptyMethod · 0.45
containsMethod · 0.45
lenMethod · 0.45

Tested by 1