From 35ee1950cfd4b07c5439ce0e77d380f868707c16 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Fri, 27 Sep 2019 22:12:34 +0200 Subject: [PATCH] Fix bad leak when using WalkDir on linux --- src/utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.rs b/src/utils.rs index c5fac70..221d3f4 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -23,14 +23,14 @@ use walkdir::WalkDir; use std::fs::create_dir; pub fn copy_dir(source_dir: &Path, dest_dir: &Path) -> Result<(), Box> { - for entry in WalkDir::new(source_dir) { + for entry in std::fs::read_dir(source_dir)? { let entry = entry?; let entry = entry.path(); if entry.is_dir() { let name = entry.file_name().expect("Error obtaining the filename"); let target_dir = dest_dir.join(name); create_dir(&target_dir)?; - copy_dir(entry, &target_dir); + copy_dir(&entry, &target_dir); }else if entry.is_file() { let target_entry = dest_dir.join(entry.file_name().expect("Error obtaining the filename")); std::fs::copy(entry, target_entry);