settings.rs

 1mod keymap_file;
 2mod settings_file;
 3mod settings_store;
 4
 5use gpui::AssetSource;
 6pub use keymap_file::{keymap_file_json_schema, KeymapFileContent};
 7pub use settings_file::*;
 8pub use settings_store::{Setting, SettingsJsonSchemaParams, SettingsStore};
 9use std::{borrow::Cow, str};
10
11pub const DEFAULT_SETTINGS_ASSET_PATH: &str = "settings/default.json";
12pub const INITIAL_USER_SETTINGS_ASSET_PATH: &str = "settings/initial_user_settings.json";
13
14pub fn initial_user_settings_content(assets: &'static impl AssetSource) -> Cow<'static, str> {
15    match assets.load(INITIAL_USER_SETTINGS_ASSET_PATH).unwrap() {
16        Cow::Borrowed(s) => Cow::Borrowed(str::from_utf8(s).unwrap()),
17        Cow::Owned(s) => Cow::Owned(String::from_utf8(s).unwrap()),
18    }
19}