From 449db68910570dea654304d4e6cf48b1e75d5043 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Sun, 9 Jun 2019 16:57:17 -0700 Subject: [PATCH] Use Build::read_dir instead of fs::read_dir in Build::cp_r Build::read_dir does better error handling when the directory doesn't exist; it actually prints the name of the directory rather than just printing the underlying error "No such file or directory" which on its own isn't very useful. --- src/bootstrap/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index ca4489655ca7b..b9d287abb0c7e 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1214,8 +1214,7 @@ impl Build { /// when this function is called. pub fn cp_r(&self, src: &Path, dst: &Path) { if self.config.dry_run { return; } - for f in t!(fs::read_dir(src)) { - let f = t!(f); + for f in self.read_dir(src) { let path = f.path(); let name = path.file_name().unwrap(); let dst = dst.join(name);