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

Function copy_corpus

src/deopt.rs:806–824  ·  view source on GitHub ↗
(from_dir: &Path, to_dir: &Path)

Source from the content-addressed store, hash-verified

804 }
805
806 pub fn copy_corpus(from_dir: &Path, to_dir: &Path) -> Result<()> {
807 crate::deopt::utils::create_dir_if_nonexist(to_dir)?;
808 let lib_corpus_files = read_all_files_in_dir(from_dir)?;
809 for file in lib_corpus_files {
810 let lib_corpus = std::fs::read(&file)?;
811 let to_file: PathBuf = [
812 to_dir.to_path_buf(),
813 file.file_name()
814 .unwrap()
815 .to_string_lossy()
816 .to_string()
817 .into(),
818 ]
819 .iter()
820 .collect();
821 std::fs::write(to_file, lib_corpus)?;
822 }
823 Ok(())
824 }
825
826 pub fn get_file_hash_set(dir: &Path) -> HashSet<String> {
827 let mut sets = HashSet::new();

Callers 1

Calls 2

create_dir_if_nonexistFunction · 0.85
read_all_files_in_dirFunction · 0.85

Tested by

no test coverage detected