From 42d4609c41be4ed7522605ed9f331d351118d54e Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sun, 25 Oct 2020 18:18:03 +0100 Subject: update to dirs-next and remove migration code --- src/main.rs | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index c8b06943..976d8d41 100644 --- a/src/main.rs +++ b/src/main.rs @@ -83,12 +83,6 @@ fn main() -> Result<()> { return Ok(()); } - // TODO: Remove this when upgrading from v0.8.x is unlikely - // Only run this migration on macOS, as it's the only platform where the config needs to be moved - if cfg!(target_os = "macos") { - migrate_config()?; - } - setup_terminal()?; defer! { shutdown_terminal().expect("shutdown failed"); @@ -237,7 +231,7 @@ fn start_terminal( } fn get_app_cache_path() -> Result { - let mut path = dirs::cache_dir() + let mut path = dirs_next::cache_dir() .ok_or_else(|| anyhow!("failed to find os cache dir."))?; path.push("gitui"); @@ -246,7 +240,7 @@ fn get_app_cache_path() -> Result { } fn get_app_config_path() -> Result { - let mut path = dirs::config_dir() + let mut path = dirs_next::config_dir() .ok_or_else(|| anyhow!("failed to find os config dir."))?; path.push("gitui"); @@ -254,29 +248,6 @@ fn get_app_config_path() -> Result { Ok(path) } -fn migrate_config() -> Result<()> { - let mut path = dirs::preference_dir().ok_or_else(|| { - anyhow!("failed to find os preference dir.") - })?; - - path.push("gitui"); - if !path.exists() { - return Ok(()); - } - - let config_path = get_app_config_path()?; - let entries = path.read_dir()?.flatten(); - for entry in entries { - let mut config_path = config_path.clone(); - config_path.push(entry.file_name()); - fs::rename(entry.path(), config_path)?; - } - - let _ = fs::remove_dir(path); - - Ok(()) -} - fn setup_logging() -> Result<()> { let mut path = get_app_cache_path()?; path.push("gitui.log"); -- cgit v1.2.3