Skip to content

Commit

Permalink
Merge pull request #32 from coolreader18/fix-native
Browse files Browse the repository at this point in the history
Fix when the `native` directory isn't present
  • Loading branch information
holmgr authored Jan 24, 2020
2 parents 9e89d6c + f78ad4a commit 22fec56
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ fn total_disk_space_in_a_profile(dir: &Path) -> Result<HashMap<String, u64>, 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)
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 22fec56

Please sign in to comment.