Remove the need for a directory for db export

Plus on import use the context directory.  We can actually write there
just fine.
This commit is contained in:
Floris Bruynooghe
2023-02-16 16:06:41 +01:00
parent dcce6ef50b
commit 490a14c5ef
9 changed files with 48 additions and 48 deletions

View File

@@ -2659,14 +2659,11 @@ void dc_str_unref (char* str);
*
* @memberof dc_backup_sender_t
* @param context The context.
* @param folder A Path to a temporary directory where the encrypted database
* export will be created. The directory is not automatically cleaned
* after the backup is sent.
* @return Opaque object for sending the backup.
* On errors, NULL is returned and dc_get_last_error()returns an error that
* should be shown to the user.
*/
dc_backup_provider_t* dc_provide_backup (dc_context_t* context, const char* folder);
dc_backup_provider_t* dc_provide_backup (dc_context_t* context);
/**

View File

@@ -4136,16 +4136,14 @@ pub type dc_backup_provider_t = BackupProvider;
#[no_mangle]
pub unsafe extern "C" fn dc_provide_backup(
context: *mut dc_context_t,
folder: *const libc::c_char,
) -> *mut dc_backup_provider_t {
if context.is_null() {
eprintln!("ignoring careless call to dc_send_backup()");
return ptr::null_mut();
}
let ctx = &*context;
let dir = as_path(folder);
block_on(async move {
BackupProvider::prepare(ctx, dir)
BackupProvider::prepare(ctx)
.await
.map(|provider| Box::into_raw(Box::new(provider)))
.log_err(ctx, "BackupProvider failed")