mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
Merge pull request #1833 from zed-industries/add-channel-to-db
Added channel info to database directories
This commit is contained in:
commit
8a095d0a55
3 changed files with 11 additions and 7 deletions
|
@ -25,9 +25,9 @@ pub struct RealDb {
|
||||||
|
|
||||||
impl Db {
|
impl Db {
|
||||||
/// Open or create a database at the given directory path.
|
/// Open or create a database at the given directory path.
|
||||||
pub fn open(db_dir: &Path) -> Self {
|
pub fn open(db_dir: &Path, channel: &'static str) -> Self {
|
||||||
// Use 0 for now. Will implement incrementing and clearing of old db files soon TM
|
// Use 0 for now. Will implement incrementing and clearing of old db files soon TM
|
||||||
let current_db_dir = db_dir.join(Path::new("0"));
|
let current_db_dir = db_dir.join(Path::new(&format!("0-{}", channel)));
|
||||||
fs::create_dir_all(¤t_db_dir)
|
fs::create_dir_all(¤t_db_dir)
|
||||||
.expect("Should be able to create the database directory");
|
.expect("Should be able to create the database directory");
|
||||||
let db_path = current_db_dir.join(Path::new("db.sqlite"));
|
let db_path = current_db_dir.join(Path::new("db.sqlite"));
|
||||||
|
|
|
@ -39,7 +39,10 @@ use settings::watched_json::{watch_keymap_file, watch_settings_file, WatchedJson
|
||||||
use theme::ThemeRegistry;
|
use theme::ThemeRegistry;
|
||||||
use util::{ResultExt, TryFutureExt};
|
use util::{ResultExt, TryFutureExt};
|
||||||
use workspace::{self, AppState, ItemHandle, NewFile, OpenPaths, Workspace};
|
use workspace::{self, AppState, ItemHandle, NewFile, OpenPaths, Workspace};
|
||||||
use zed::{self, build_window_options, initialize_workspace, languages, menus, RELEASE_CHANNEL};
|
use zed::{
|
||||||
|
self, build_window_options, initialize_workspace, languages, menus, RELEASE_CHANNEL,
|
||||||
|
RELEASE_CHANNEL_NAME,
|
||||||
|
};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let http = http::client();
|
let http = http::client();
|
||||||
|
@ -52,9 +55,10 @@ fn main() {
|
||||||
.or_else(|| app.platform().app_version().ok())
|
.or_else(|| app.platform().app_version().ok())
|
||||||
.map_or("dev".to_string(), |v| v.to_string());
|
.map_or("dev".to_string(), |v| v.to_string());
|
||||||
init_panic_hook(app_version, http.clone(), app.background());
|
init_panic_hook(app_version, http.clone(), app.background());
|
||||||
let db = app
|
|
||||||
.background()
|
let db = app.background().spawn(async move {
|
||||||
.spawn(async move { project::Db::open(&*zed::paths::DB_DIR) });
|
project::Db::open(&*zed::paths::DB_DIR, RELEASE_CHANNEL_NAME.as_str())
|
||||||
|
});
|
||||||
|
|
||||||
load_embedded_fonts(&app);
|
load_embedded_fonts(&app);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ actions!(
|
||||||
const MIN_FONT_SIZE: f32 = 6.0;
|
const MIN_FONT_SIZE: f32 = 6.0;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref RELEASE_CHANNEL_NAME: String =
|
pub static ref RELEASE_CHANNEL_NAME: String =
|
||||||
env::var("ZED_RELEASE_CHANNEL").unwrap_or(include_str!("../RELEASE_CHANNEL").to_string());
|
env::var("ZED_RELEASE_CHANNEL").unwrap_or(include_str!("../RELEASE_CHANNEL").to_string());
|
||||||
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() {
|
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() {
|
||||||
"dev" => ReleaseChannel::Dev,
|
"dev" => ReleaseChannel::Dev,
|
||||||
|
|
Loading…
Reference in a new issue