Skip to content

Commit 33d4e97

Browse files
author
chenjunliang
committed
文件清理路径错误修复
1 parent 99b6a00 commit 33d4e97

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tasks.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ fn mysql_audit_log_rotate(sched: &mut JobScheduler, path: String, max_size: u32,
5858
if files.len() > max_file as usize {
5959
println!("The number of files exceeds the limit,start cleaning...");
6060
for i in 0..(files.len() - max_file as usize) {
61-
let item_path = files.get(i).unwrap();
61+
let item_file_name = files.get(i).unwrap();
62+
let item_path = parent_path.to_str().unwrap().to_owned() + "/" + item_file_name;
6263
fs::remove_file(item_path.as_str()).expect("Failed to clean up redundant files");
64+
println!("Delete file {}", item_path);
6365
}
6466
}
6567
}

0 commit comments

Comments
 (0)