fix only process one file.

This commit is contained in:
licsber 2024-09-08 10:54:59 +08:00
parent f52148194f
commit bd58da1c17

View File

@ -41,7 +41,7 @@ fn process_compressed_files(path: &Path) -> io::Result<()> {
process_compressed_files(&entry_path)?; process_compressed_files(&entry_path)?;
} else if let Some(ext) = entry_path.extension().and_then(|e| e.to_str()) { } else if let Some(ext) = entry_path.extension().and_then(|e| e.to_str()) {
if ext == "rar" || ext == "zip" { if ext == "rar" || ext == "zip" {
return unar_file(&entry_path); unar_file(&entry_path).expect("UNAR Error.");
} }
} }
} }
@ -58,6 +58,10 @@ fn main() -> io::Result<()> {
PathBuf::from(".") PathBuf::from(".")
}; };
if start_path.is_file() {
return unar_file(&start_path);
}
process_compressed_files(&start_path)?; process_compressed_files(&start_path)?;
Ok(()) Ok(())