mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
chore: Remove unused function delete_files_in_dir() (#6454)
This commit is contained in:
18
src/tools.rs
18
src/tools.rs
@@ -26,7 +26,7 @@ use chrono::{Local, NaiveDateTime, NaiveTime, TimeZone};
|
|||||||
use deltachat_contact_tools::EmailAddress;
|
use deltachat_contact_tools::EmailAddress;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub use deltachat_time::SystemTimeTools as SystemTime;
|
pub use deltachat_time::SystemTimeTools as SystemTime;
|
||||||
use futures::{StreamExt, TryStreamExt};
|
use futures::TryStreamExt;
|
||||||
use mailparse::dateparse;
|
use mailparse::dateparse;
|
||||||
use mailparse::headers::Headers;
|
use mailparse::headers::Headers;
|
||||||
use mailparse::MailHeaderMap;
|
use mailparse::MailHeaderMap;
|
||||||
@@ -366,22 +366,6 @@ pub(crate) async fn delete_file(context: &Context, path: impl AsRef<Path>) -> Re
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn delete_files_in_dir(context: &Context, path: impl AsRef<Path>) -> Result<()> {
|
|
||||||
let read_dir = tokio::fs::read_dir(path)
|
|
||||||
.await
|
|
||||||
.context("could not read dir to delete")?;
|
|
||||||
let mut read_dir = tokio_stream::wrappers::ReadDirStream::new(read_dir);
|
|
||||||
while let Some(entry) = read_dir.next().await {
|
|
||||||
match entry {
|
|
||||||
Ok(file) => {
|
|
||||||
delete_file(context, file.file_name()).await?;
|
|
||||||
}
|
|
||||||
Err(e) => warn!(context, "Could not read file to delete: {}", e),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A guard which will remove the path when dropped.
|
/// A guard which will remove the path when dropped.
|
||||||
///
|
///
|
||||||
/// It implements [`Deref`] so it can be used as a `&Path`.
|
/// It implements [`Deref`] so it can be used as a `&Path`.
|
||||||
|
|||||||
Reference in New Issue
Block a user