paths: Replace lazy_static! with OnceLock (#13213)

This PR replaces the `lazy_static!` usages in the `paths` crate with
`OnceLock` from the standard library.

This allows us to drop the `lazy_static` dependency from this crate.

The paths are now exposed as accessor functions that reference a private
static value.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-06-18 12:22:37 -04:00 committed by GitHub
parent ba59e66314
commit 81475ac4cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 322 additions and 172 deletions

View file

@ -20,7 +20,6 @@ use gpui::{
use heed::{types::SerdeBincode, Database, RoTxn};
use language::{language_settings::SoftWrap, Buffer, LanguageRegistry};
use parking_lot::RwLock;
use paths::PROMPTS_DIR;
use picker::{Picker, PickerDelegate};
use rope::Rope;
use serde::{Deserialize, Serialize};
@ -49,7 +48,7 @@ actions!(
/// Init starts loading the PromptStore in the background and assigns
/// a shared future to a global.
pub fn init(cx: &mut AppContext) {
let db_path = PROMPTS_DIR.join("prompts-library-db.0.mdb");
let db_path = paths::prompts_dir().join("prompts-library-db.0.mdb");
let prompt_store_future = PromptStore::new(db_path, cx.background_executor().clone())
.then(|result| future::ready(result.map(Arc::new).map_err(Arc::new)))
.boxed()