diff --git a/rust/src/files.rs b/rust/src/files.rs index 4061d2ab83c2c..ab33b10681520 100644 --- a/rust/src/files.rs +++ b/rust/src/files.rs @@ -198,7 +198,13 @@ pub fn unzip( } remove_file(compressed_path)?; - copy_folder_content(tmp_path, final_path, single_file)?; + copy_folder_content( + tmp_path, + final_path, + single_file, + &compressed_path.to_path_buf(), + &log, + )?; Ok(()) } @@ -207,12 +213,18 @@ pub fn copy_folder_content( source: impl AsRef, destination: impl AsRef, single_file: Option, + avoid_path: &PathBuf, + log: &Logger, ) -> io::Result<()> { fs::create_dir_all(&destination)?; for dir_entry in fs::read_dir(source)? { let entry = dir_entry?; let file_type = entry.file_type()?; + let destination_path = destination.as_ref().join(entry.file_name()); if file_type.is_file() { + if entry.path().eq(avoid_path) { + continue; + } let target_file_name = entry .file_name() .to_os_string() @@ -221,7 +233,11 @@ pub fn copy_folder_content( if single_file.is_none() || (single_file.is_some() && single_file.clone().unwrap().eq(&target_file_name)) { - let destination_path = destination.as_ref().join(entry.file_name()); + log.trace(format!( + "Copying {} to {}", + entry.path().display(), + destination_path.display() + )); if !destination_path.exists() { fs::copy(entry.path(), destination_path)?; } @@ -229,8 +245,10 @@ pub fn copy_folder_content( } else if single_file.is_none() { copy_folder_content( entry.path(), - destination.as_ref().join(entry.file_name()), + destination_path, single_file.clone(), + avoid_path, + &log, )?; } } diff --git a/rust/tests/browser_tests.rs b/rust/tests/browser_tests.rs index 1d96737fb40c9..879274f4f770b 100644 --- a/rust/tests/browser_tests.rs +++ b/rust/tests/browser_tests.rs @@ -69,7 +69,7 @@ fn wrong_parameters_test( let mut cmd = Command::new(env!("CARGO_BIN_EXE_selenium-manager")); let assert_result = cmd .args([ - "--trace", + "--debug", "--browser", &browser, "--browser-version", diff --git a/rust/tests/chrome_download_tests.rs b/rust/tests/chrome_download_tests.rs index 76926f4b42296..bc2983de61d3d 100644 --- a/rust/tests/chrome_download_tests.rs +++ b/rust/tests/chrome_download_tests.rs @@ -31,7 +31,7 @@ fn chrome_latest_download_test() { "--force-browser-download", "--output", "json", - "--trace", + "--debug", ]) .assert() .success() @@ -53,7 +53,7 @@ fn chrome_version_download_test(#[case] browser_version: String) { &browser_version, "--output", "json", - "--trace", + "--debug", ]) .assert() .success()