pub fn is_directory_empty(path: &Path, allow_hidden: bool) -> Result<bool>Expand description
Check if a directory is empty.
Utility function that checks if a directory is empty.
§Panics
This function uses anyhow::Result for error handling, allowing for simple and flexible error management.
Errors can occur when reading the directory (io error). Errors will be of type anyhow::Error.
§Example
use std::path::Path;
use modelcards::utils::is_directory_empty;
let path = Path::new(".");
if is_directory_empty(path, true).expect("Failed to read directory") {
println!("Directory is empty!");
}