Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- scrollbar in long commit messages [[@timaliberdov](https://github.com/timaliberdov)] ([#308](https://github.com/extrawurst/gitui/issues/308))

### Changed
- upgrade `dirs` to `dirs-next` / remove cfg migration code ([#351](https://github.com/extrawurst/gitui/issues/351)) ([#366](https://github.com/extrawurst/gitui/issues/366))
- do not highlight selection in diff view when not focused ([#270](https://github.com/extrawurst/gitui/issues/270))
- copy to clipboard using `xclip`(linux), `pbcopy`(mac) or `clip`(win) [[@cruessler](https://github.com/cruessler)] ([#262](https://github.com/extrawurst/gitui/issues/262))
- compact treeview [[@WizardOhio24](https://github.com/WizardOhio24)] ([#192](https://github.com/extrawurst/gitui/issues/192))
Expand Down
17 changes: 9 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ itertools = "0.9"
rayon-core = "1.9"
log = "0.4"
simplelog = { version = "0.8", default-features = false }
dirs = "3.0"
dirs-next = "2.0"
crossbeam-channel = "0.5"
scopeguard = "1.1"
bitflags = "1.2"
Expand Down
33 changes: 2 additions & 31 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand All @@ -246,37 +240,14 @@ 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");
fs::create_dir_all(&path)?;
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");
Expand Down