summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorStephan Dilly <dilly.stephan@gmail.com>2020-10-25 18:18:03 +0100
committerStephan Dilly <dilly.stephan@gmail.com>2020-10-25 18:28:52 +0100
commit42d4609c41be4ed7522605ed9f331d351118d54e (patch)
treedb2e066b8a99c6739525379a646f462680c06f8e /src/main.rs
parent4ee4432f16db0e845de4e1862cfeb84fc39a61b2 (diff)
update to dirs-next and remove migration code
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs33
1 files changed, 2 insertions, 31 deletions
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<W: Write>(
}
fn get_app_cache_path() -> Result<PathBuf> {
- 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<PathBuf> {
}
fn get_app_config_path() -> Result<PathBuf> {
- 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<PathBuf> {
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");