mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-01 07:38:11 +08:00
Desktop set cef data and cache directory (#2927)
This commit is contained in:
@@ -4,6 +4,8 @@ use cef::{Browser, CefString, Settings, api_hash, args::Args, execute_process};
|
||||
use thiserror::Error;
|
||||
use winit::event::WindowEvent;
|
||||
|
||||
use crate::cef::dirs::{cef_cache_dir, cef_data_dir};
|
||||
|
||||
use super::input::InputState;
|
||||
use super::scheme_handler::{FRONTEND_DOMAIN, GRAPHITE_SCHEME};
|
||||
use super::{CefEventHandler, input};
|
||||
@@ -62,6 +64,8 @@ impl Context<Setup> {
|
||||
windowless_rendering_enabled: 1,
|
||||
multi_threaded_message_loop: 0,
|
||||
external_message_pump: 1,
|
||||
root_cache_path: cef_data_dir().to_str().map(CefString::from).unwrap(),
|
||||
cache_path: cef_cache_dir().to_str().map(CefString::from).unwrap(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use crate::dirs::{ensure_dir_exists, graphite_data_dir};
|
||||
|
||||
static CEF_DIR_NAME: &str = "browser";
|
||||
|
||||
pub(crate) fn cef_data_dir() -> PathBuf {
|
||||
let path = graphite_data_dir().join(CEF_DIR_NAME);
|
||||
ensure_dir_exists(&path);
|
||||
path
|
||||
}
|
||||
|
||||
pub(crate) fn cef_cache_dir() -> PathBuf {
|
||||
let path = cef_data_dir().join("cache");
|
||||
ensure_dir_exists(&path);
|
||||
path
|
||||
}
|
||||
Reference in New Issue
Block a user