Use rocksdb to store project paths' public/private state
This commit is contained in:
parent
724affc442
commit
f7e7a7c6a7
8 changed files with 324 additions and 28 deletions
|
@ -48,9 +48,10 @@ use zed::{
|
|||
|
||||
fn main() {
|
||||
let http = http::client();
|
||||
let logs_dir_path = dirs::home_dir()
|
||||
.expect("could not find home dir")
|
||||
.join("Library/Logs/Zed");
|
||||
let home_dir = dirs::home_dir().expect("could not find home dir");
|
||||
let db_dir_path = home_dir.join("Library/Application Support/Zed");
|
||||
let logs_dir_path = home_dir.join("Library/Logs/Zed");
|
||||
fs::create_dir_all(&db_dir_path).expect("could not create database path");
|
||||
fs::create_dir_all(&logs_dir_path).expect("could not create logs path");
|
||||
init_logger(&logs_dir_path);
|
||||
|
||||
|
@ -59,6 +60,11 @@ fn main() {
|
|||
.or_else(|| app.platform().app_version().ok())
|
||||
.map_or("dev".to_string(), |v| v.to_string());
|
||||
init_panic_hook(logs_dir_path, app_version, http.clone(), app.background());
|
||||
let db = app.background().spawn(async move {
|
||||
project::Db::open(db_dir_path.join("zed.db"))
|
||||
.log_err()
|
||||
.unwrap_or(project::Db::null())
|
||||
});
|
||||
|
||||
load_embedded_fonts(&app);
|
||||
|
||||
|
@ -136,7 +142,6 @@ fn main() {
|
|||
let client = client::Client::new(http.clone());
|
||||
let mut languages = languages::build_language_registry(login_shell_env_loaded);
|
||||
let user_store = cx.add_model(|cx| UserStore::new(client.clone(), http.clone(), cx));
|
||||
let project_store = cx.add_model(|_| ProjectStore::default());
|
||||
|
||||
context_menu::init(cx);
|
||||
auto_update::init(http, client::ZED_SERVER_URL.clone(), cx);
|
||||
|
@ -156,6 +161,7 @@ fn main() {
|
|||
search::init(cx);
|
||||
vim::init(cx);
|
||||
|
||||
let db = cx.background().block(db);
|
||||
let (settings_file, keymap_file) = cx.background().block(config_files).unwrap();
|
||||
let mut settings_rx = settings_from_files(
|
||||
default_settings,
|
||||
|
@ -191,6 +197,7 @@ fn main() {
|
|||
.detach();
|
||||
cx.set_global(settings);
|
||||
|
||||
let project_store = cx.add_model(|_| ProjectStore::new(db));
|
||||
let app_state = Arc::new(AppState {
|
||||
languages,
|
||||
themes,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue