From 450e6a22f6cf41ae11f18c2265e9ac8a5d76f2a7 Mon Sep 17 00:00:00 2001 From: Soc Virnyl Estela Date: Mon, 21 Oct 2024 21:40:50 +0800 Subject: [PATCH] logging: set to trace level for filter_paths Signed-off-by: Soc Virnyl Estela --- libroast/src/operations/roast.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libroast/src/operations/roast.rs b/libroast/src/operations/roast.rs index e37f818..5ea7a3f 100644 --- a/libroast/src/operations/roast.rs +++ b/libroast/src/operations/roast.rs @@ -56,10 +56,12 @@ fn filter_paths( if p_path.is_file() { let dst = &root.join(&w_path); + let parent = dst.parent().unwrap_or(Path::new("/")); + fs::create_dir_all(parent)?; debug!(?dst, "destination"); if dst.exists() { - warn!( + trace!( "⚠️ Additional file will overwrite existing file at path `{}`.", dst.display() ); @@ -77,7 +79,7 @@ fn filter_paths( { if dst.exists() { - warn!( + trace!( "⚠️ Additional directory will overwrite existing directory at \ path `{}`.", dst.display() @@ -102,7 +104,7 @@ fn is_hidden(entry: &DirEntry, hidden: bool, ignore_git: bool, root: &Path) -> b let root_canonicalized = root.canonicalize().unwrap_or(root.to_path_buf()); if entry_canonicalized == root_canonicalized { - return false; + false } else if ignore_git { @@ -248,6 +250,7 @@ pub fn roast_opts(roast_args: cli::RoastArgs, start_trace: bool) -> io::Result<( else if path.is_file() { let parent = path.parent().unwrap_or(Path::new("/")); + fs::create_dir_all(parent)?; for ig_path in &ignore_paths { let ig_path_canonicalized = @@ -274,13 +277,14 @@ pub fn roast_opts(roast_args: cli::RoastArgs, start_trace: bool) -> io::Result<( break; } } + let parent = dst.parent().unwrap_or(Path::new("/")); let dst_parent = &setup_workdir.join(parent.file_name().unwrap_or(parent.as_os_str())); fs::create_dir_all(dst_parent)?; debug!(?path, "Destination path"); filter_paths( &path, - dst_parent, + parent, roast_args.hidden, roast_args.ignore_git, &ignore_paths, @@ -306,6 +310,8 @@ pub fn roast_opts(roast_args: cli::RoastArgs, start_trace: bool) -> io::Result<( } else if path.is_file() { + let parent = dst.parent().unwrap_or(Path::new("/")); + fs::create_dir_all(parent)?; if dst.exists() { warn!(