This commit is contained in:
Dmitry Belyaev 2022-08-25 15:50:37 +03:00
parent 80382751df
commit 7d17e904fc
Signed by: b4tman
GPG Key ID: 41A00BF15EA7E5F3

View File

@ -244,7 +244,6 @@ impl<T> SplitTo<T> for Vec<T> {
}
}
fn process_files(files: &&[PathBuf]) {
if files.is_empty() {
return;
@ -302,15 +301,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_dir: PathBuf = OUTPUT_PATH.into();
if out_dir.is_file() {
return Err("output directory is file!".into());
}
else if !out_dir.exists() {
} else if !out_dir.exists() {
fs::create_dir_all(out_dir)?;
};
println!("processing {} files with {} threads...", source_files.len(), rayon::current_num_threads());
println!(
"processing {} files with {} threads...",
source_files.len(),
rayon::current_num_threads()
);
// split vector and process its parts in parallel
source_files.split_to(rayon::current_num_threads())
source_files
.split_to(rayon::current_num_threads())
.par_iter()
.for_each(process_files);