add a new tested context.new_blob_dir method to simplify writing out blob files

This commit is contained in:
holger krekel
2019-09-29 01:01:19 +02:00
committed by Floris Bruynooghe
parent a6d0464735
commit 7a9fdb4acd
5 changed files with 211 additions and 61 deletions

View File

@@ -129,14 +129,15 @@ pub fn initiate_key_transfer(context: &Context) -> Result<String> {
.unwrap()
.shall_stop_ongoing
{
let setup_file_name =
dc_get_fine_path_filename(context, "$BLOBDIR", "autocrypt-setup-message.html");
if dc_write_file(context, &setup_file_name, setup_file_content.as_bytes()) {
let setup_file_name = context.new_blob_file(
"autocrypt-setup-message.html",
setup_file_content.as_bytes(),
)?;
{
if let Ok(chat_id) = chat::create_by_contact_id(context, 1) {
msg = Message::default();
msg.type_0 = Viewtype::File;
msg.param
.set(Param::File, setup_file_name.to_string_lossy());
msg.param.set(Param::File, setup_file_name);
msg.param
.set(Param::MimeType, "application/autocrypt-setup");
@@ -579,6 +580,7 @@ fn export_backup(context: &Context, dir: impl AsRef<Path>) -> Result<()> {
.format("delta-chat-%Y-%m-%d.bak")
.to_string();
// let dest_path_filename = dc_get_next_backup_file(context, dir, res);
let dest_path_filename = dc_get_fine_path_filename(context, dir, res);
sql::housekeeping(context);