diff --git a/src/db.rs b/src/db.rs index 3068ac0..a3f2802 100644 --- a/src/db.rs +++ b/src/db.rs @@ -16,8 +16,6 @@ pub struct DB { data: DBData, modified: bool, path: PathBuf, - // FIXME: remove after next breaking version - path_old: Option, } impl DB { @@ -44,34 +42,6 @@ impl DB { data, modified: false, path: path.as_ref().to_path_buf(), - path_old: None, - }) - } - - // FIXME: remove after next breaking version - pub fn open_and_migrate(path_old: P1, path: P2) -> Result - where - P1: AsRef, - P2: AsRef, - { - let file = File::open(&path_old).context("could not open old database file")?; - let reader = BufReader::new(&file); - - let dirs = bincode::config() - .limit(config::DB_MAX_SIZE) - .deserialize_from(reader) - .context("could not deserialize old database")?; - - let data = DBData { - version: config::DB_VERSION, - dirs, - }; - - Ok(DB { - data, - modified: true, - path: path.as_ref().to_path_buf(), - path_old: Some(path_old.as_ref().to_path_buf()), }) } @@ -295,11 +265,6 @@ impl Drop for DB { fn drop(&mut self) { if let Err(e) = self.save() { eprintln!("{:#}", e); - } else if let Some(path_old) = &self.path_old { - // FIXME: remove this branch after next breaking release - if let Err(e) = fs::remove_file(path_old).context("could not remove old database") { - eprintln!("{:#}", e); - } } } } diff --git a/src/main.rs b/src/main.rs index daf7d0f..c5a4502 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use structopt::StructOpt; use std::process; #[derive(Debug, StructOpt)] -#[structopt(about = "A cd command that learns your habits", version = env!("ZOXIDE_VERSION"))] +#[structopt(about, version = env!("ZOXIDE_VERSION"))] enum Zoxide { Add(subcommand::Add), Import(subcommand::Import), diff --git a/src/util.rs b/src/util.rs index 89d7a51..d8cbcb1 100644 --- a/src/util.rs +++ b/src/util.rs @@ -47,17 +47,6 @@ pub fn get_db() -> Result { let mut db_path = config::zo_data_dir()?; db_path.push("db.zo"); - // FIXME: fallback to old database location; remove in next breaking version - if !db_path.is_file() { - if let Some(mut old_db_path) = dirs::home_dir() { - old_db_path.push(".zo"); - - if old_db_path.is_file() { - return DB::open_and_migrate(old_db_path, db_path); - } - } - } - DB::open(db_path) } @@ -94,7 +83,6 @@ where dir_frecencies.sort_unstable_by_key(|&(dir, frecency)| Reverse((frecency, &dir.path))); for &(dir, frecency) in dir_frecencies.iter() { - // ensure that frecency fits in 4 characters if let Ok(path_bytes) = path_to_bytes(&dir.path) { (|| { write!(fzf_stdin, "{:>4} ", frecency)?;