fix: speed up checking if dir is empty

This commit is contained in:
Tim Schubert 2025-08-09 20:06:20 +02:00
parent 7aae7f84d8
commit bc24fe35b6
No known key found for this signature in database

View file

@ -43,7 +43,7 @@ impl<T: AsRef<Path> + AsRef<OsStr>> SrcRoot<T> {
fn ensure_repo_checkout(&self, url: &Url) -> Result<PathBuf> {
let repo_path = self.as_repo_path(url);
if !repo_path.is_dir() || repo_path.read_dir()?.count() == 0 {
if !repo_path.is_dir() || repo_path.read_dir()?.next().is_none() {
create_dir_all(&repo_path)?;
self.clone_repo(url)?;
}