diff --git a/src/fingerprint.rs b/src/fingerprint.rs index 2f737ca..5042776 100644 --- a/src/fingerprint.rs +++ b/src/fingerprint.rs @@ -242,7 +242,11 @@ fn total_disk_space_in_a_profile(dir: &Path) -> Result, Err total_disk_space_by_hash_in_a_dir(&dir.join("deps"), &mut total_disk_space)?; // examples is just final artifacts not tracked by fingerprint so skip that one. // incremental is not tracked by fingerprint so skip that one. - total_disk_space_by_hash_in_a_dir(&dir.join("native"), &mut total_disk_space)?; + // `native` isn't generated by cargo since 1.37.0 + let native_dir = dir.join("native"); + if native_dir.exists() { + total_disk_space_by_hash_in_a_dir(&native_dir, &mut total_disk_space)?; + } total_disk_space_by_hash_in_a_dir(dir, &mut total_disk_space)?; Ok(total_disk_space) } @@ -262,7 +266,11 @@ fn remove_not_built_with_in_a_profile( total_disk_space += remove_not_matching_in_a_dir(&dir.join("deps"), &keep, dry_run)?; // examples is just final artifacts not tracked by fingerprint so skip that one. // incremental is not tracked by fingerprint so skip that one. - total_disk_space += remove_not_matching_in_a_dir(&dir.join("native"), &keep, dry_run)?; + // `native` isn't generated by cargo since 1.37.0 + let native_dir = dir.join("native"); + if native_dir.exists() { + total_disk_space += remove_not_matching_in_a_dir(&native_dir, &keep, dry_run)?; + } total_disk_space += remove_not_matching_in_a_dir(dir, &keep, dry_run)?; Ok(total_disk_space) }