add DC_EVENT_DELETED_BLOB_FILE

This commit is contained in:
holger krekel
2019-10-03 16:16:17 +02:00
parent 467c09f491
commit 603761e4b7
6 changed files with 27 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ use rand::{thread_rng, Rng};
use crate::context::Context;
use crate::error::Error;
use crate::events::Event;
pub(crate) fn dc_exactly_one_bit_set(v: libc::c_int) -> bool {
0 != v && 0 == v & (v - 1)
@@ -512,10 +513,14 @@ pub(crate) fn dc_delete_file(context: &Context, path: impl AsRef<std::path::Path
return false;
}
let dpath = format!("{}", path.as_ref().to_string_lossy());
match fs::remove_file(path_abs) {
Ok(_) => true,
Ok(_) => {
context.call_cb(Event::DeletedBlobFile(dpath));
true
}
Err(_err) => {
warn!(context, "Cannot delete \"{}\".", path.as_ref().display());
warn!(context, "Cannot delete \"{}\".", dpath);
false
}
}