MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / read_sort_dir

Function read_sort_dir

src/deopt.rs:644–658  ·  view source on GitHub ↗

read the directory and sort the entries by the alphabet oder

(dir: &Path)

Source from the content-addressed store, hash-verified

642
643 /// read the directory and sort the entries by the alphabet oder
644 pub fn read_sort_dir(dir: &Path) -> Result<Vec<PathBuf>> {
645 let mut entries = Vec::new();
646 if !dir.exists() {
647 return Ok(entries);
648 }
649 if !dir.is_dir() {
650 eyre::bail!("{dir:?} is not a directory")
651 }
652 for entry in std::fs::read_dir(dir)? {
653 let path = entry?.path();
654 entries.push(path);
655 }
656 entries.sort();
657 Ok(entries)
658 }
659
660 pub fn is_dir_empty(dir: &Path) -> Result<bool> {
661 read_sort_dir(dir).map(|entries| entries.is_empty())

Callers 15

is_dir_emptyFunction · 0.85
minimizeFunction · 0.85
test_fd_sanitizeFunction · 0.85
exploit_transformMethod · 0.85
synthesisMethod · 0.85

Calls 1

pushMethod · 0.45

Tested by 3

test_fd_sanitizeFunction · 0.68
test_static_inferFunction · 0.68