Desktop set cef data and cache directory (#2927)

This commit is contained in:
Timon
2025-07-24 16:56:57 +00:00
committed by GitHub
parent e7b8b5a3b6
commit 9f4f3681c3
8 changed files with 85 additions and 10 deletions
+16
View File
@@ -0,0 +1,16 @@
use std::fs::create_dir_all;
use std::path::PathBuf;
static APP_NAME: &str = "graphite-desktop";
pub(crate) fn ensure_dir_exists(path: &PathBuf) {
if !path.exists() {
create_dir_all(path).unwrap_or_else(|_| panic!("Failed to create directory at {path:?}"));
}
}
pub(crate) fn graphite_data_dir() -> PathBuf {
let path = dirs::data_dir().expect("Failed to get data directory").join(APP_NAME);
ensure_dir_exists(&path);
path
}