From f2df1f5ec6648713791c07b5ca79fa4da87b7d74 Mon Sep 17 00:00:00 2001 From: Nikolay Merinov Date: Fri, 1 Dec 2017 14:28:14 +0500 Subject: [PATCH] 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. --- src/build_helper/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs index 97723e260f6..2b6e2828cfb 100644 --- a/src/build_helper/lib.rs +++ b/src/build_helper/lib.rs @@ -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,