del files use for loop
This commit is contained in:
16
src/main.rs
16
src/main.rs
@@ -132,17 +132,13 @@ pub fn process_config_item(options: &Options, config_item: &OSSBackupdConfigItem
|
|||||||
let temp_pgp_file = &format!("temp_file_{}.gpg", secs);
|
let temp_pgp_file = &format!("temp_file_{}.gpg", secs);
|
||||||
|
|
||||||
let remove_temp_files = || {
|
let remove_temp_files = || {
|
||||||
if Path::new(temp_zip_file).is_file() {
|
for f in vec![temp_zip_file, temp_pgp_file] {
|
||||||
if options.verbose {
|
if Path::new(f).is_file() {
|
||||||
print_message(MessageType::DEBUG, &format!("Remove file: {}", temp_zip_file));
|
if options.verbose {
|
||||||
|
print_message(MessageType::DEBUG, &format!("Remove file: {}", f));
|
||||||
|
}
|
||||||
|
fs::remove_file(f).ok();
|
||||||
}
|
}
|
||||||
fs::remove_file(temp_zip_file).ok();
|
|
||||||
}
|
|
||||||
if Path::new(temp_pgp_file).is_file() {
|
|
||||||
if options.verbose {
|
|
||||||
print_message(MessageType::DEBUG, &format!("Remove file: {}", temp_pgp_file));
|
|
||||||
}
|
|
||||||
fs::remove_file(temp_pgp_file).ok();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user