1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 08:25:16 +00:00

Start conversations system migration

This commit is contained in:
2021-03-02 18:57:34 +01:00
parent cd5419edea
commit 60733f2d04
7 changed files with 262 additions and 30 deletions

View File

@ -7,7 +7,7 @@ use std::path::{Path, PathBuf};
use serde_json::to_string;
use crate::data::config::conf;
use crate::data::error::{ExecError, ResultBoxError};
use crate::data::error::{ExecError, Res, ResultBoxError};
use crate::data::user::UserID;
use crate::utils::crypt_utils::rand_str;
@ -61,4 +61,13 @@ pub fn generate_new_user_data_file_name(dir: &Path, ext: &str) -> ResultBoxError
return Ok(dir.join(&file));
}
}
}
/// Delete a file from user data, if it exists
pub fn delete_user_data_file_if_exists(path: &str) -> Res {
let path = user_data_path(path.as_ref());
if path.exists() {
std::fs::remove_file(path)?;
}
Ok(())
}