mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-22 19:29:14 +03:00
update to dirs-next and remove migration code
This commit is contained in:
parent
4ee4432f16
commit
42d4609c41
@ -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))
|
||||
|
17
Cargo.lock
generated
17
Cargo.lock
generated
@ -355,19 +355,20 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "3.0.1"
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "142995ed02755914747cc6ca76fc7e4583cd18578746716d0508ea6ed558b9ff"
|
||||
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
"cfg-if 1.0.0",
|
||||
"dirs-sys-next",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.5"
|
||||
name = "dirs-sys-next"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a"
|
||||
checksum = "99de365f605554ae33f115102a02057d4fc18b01f3284d6870be0938743cfe7d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
@ -447,7 +448,7 @@ dependencies = [
|
||||
"clap",
|
||||
"crossbeam-channel",
|
||||
"crossterm 0.18.0",
|
||||
"dirs",
|
||||
"dirs-next",
|
||||
"itertools",
|
||||
"log",
|
||||
"pprof",
|
||||
|
@ -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"
|
||||
|
33
src/main.rs
33
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");
|
||||
|
Loading…
Reference in New Issue
Block a user