wallet: fix paths storing DBs to use ~/.local/share/darkfi/wallet/, and cache dirs to use ~/.cache/darkfi/wallet/

This commit is contained in:
darkfi
2025-01-13 13:53:52 +01:00
parent 3346b63b70
commit 7b4aea3f2b
4 changed files with 14 additions and 8 deletions

View File

@@ -77,10 +77,10 @@ mod desktop_paths {
pub const BG_PATH: &str = "assets/bg.png";
pub fn get_chatdb_path() -> PathBuf {
dirs::cache_dir().unwrap().join("darkfi/chatdb")
dirs::data_local_dir().unwrap().join("darkfi/wallet/chatdb")
}
pub fn get_first_time_filename() -> PathBuf {
dirs::cache_dir().unwrap().join("darkfi/first_time")
dirs::cache_dir().unwrap().join("darkfi/wallet/first_time")
}
}
@@ -237,7 +237,11 @@ pub async fn make(app: &App, window: SceneNodePtr) {
let is_first_time = !get_first_time_filename().exists();
if is_first_time {
let _ = File::create(get_first_time_filename());
let filename = get_first_time_filename();
if let Some(parent) = filename.parent() {
let _ = fs::create_dir_all(parent);
}
let _ = File::create(filename);
}
let chatdb_path = get_chatdb_path();

View File

@@ -133,7 +133,7 @@ impl RenderApi {
gfx_texture_id
}
pub fn new_texture<F>(
pub fn new_texture<F, S>(
&self,
width: u16,
height: u16,
@@ -141,7 +141,8 @@ impl RenderApi {
make_debug: F,
) -> ManagedTexturePtr
where
F: Fn() -> String,
F: Fn() -> S,
S: Into<String>,
{
let debug = if DEBUG_RESRC { make_debug().into() } else { String::new() };
Arc::new(ManagedTexture {

View File

@@ -58,7 +58,7 @@ fn get_evgrdb_path() -> PathBuf {
}
#[cfg(not(target_os = "android"))]
fn get_evgrdb_path() -> PathBuf {
dirs::cache_dir().unwrap().join("darkfi/evgr")
dirs::data_local_dir().unwrap().join("darkfi/evgr")
}
#[cfg(target_os = "android")]

View File

@@ -135,9 +135,10 @@ impl<'a> Atlas<'a> {
/// Each glyph is given a sub-rect within the texture, accessible by calling
/// `rendered_atlas.fetch_uv(my_glyph_id)`.
/// The texture ID is a struct member: `rendered_atlas.texture_id`.
pub fn make<F>(self, debug_info: F) -> RenderedAtlas
pub fn make<F, S>(self, debug_info: F) -> RenderedAtlas
where
F: Fn() -> String,
F: Fn() -> S,
S: Into<String>,
{
//if self.glyph_ids.is_empty() {
// return Err(Error::AtlasIsEmpty);