@@ -25,9 +25,9 @@ pub struct RealDb {
impl Db {
/// 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
- 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)
.expect("Should be able to create the database directory");
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 util::{ResultExt, TryFutureExt};
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() {
let http = http::client();
@@ -52,9 +55,10 @@ fn main() {
.or_else(|| app.platform().app_version().ok())
.map_or("dev".to_string(), |v| v.to_string());
init_panic_hook(app_version, http.clone(), app.background());
- let db = app
- .background()
- .spawn(async move { project::Db::open(&*zed::paths::DB_DIR) });
+
+ let db = app.background().spawn(async move {
+ project::Db::open(&*zed::paths::DB_DIR, RELEASE_CHANNEL_NAME.as_str())
+ });
load_embedded_fonts(&app);
@@ -71,7 +71,7 @@ actions!(
const MIN_FONT_SIZE: f32 = 6.0;
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());
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() {
"dev" => ReleaseChannel::Dev,