build_helper: destination file can't be up to date when not exists
Function "up_to_date" return incorrect result if mtime for all fetched sources is set to epoch time. Add existence check to function.
This commit is contained in:
parent
804b15be82
commit
f2df1f5ec6
1 changed files with 3 additions and 0 deletions
|
@ -190,6 +190,9 @@ pub fn mtime(path: &Path) -> FileTime {
|
|||
///
|
||||
/// Uses last-modified time checks to verify this.
|
||||
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
|
||||
if !dst.exists() {
|
||||
return false;
|
||||
}
|
||||
let threshold = mtime(dst);
|
||||
let meta = match fs::metadata(src) {
|
||||
Ok(meta) => meta,
|
||||
|
|
Loading…
Reference in a new issue