Set MacOS config directory to ~/.config (#379)

This commit is contained in:
remique 2021-02-16 22:52:32 +01:00 committed by GitHub
parent be3a33e862
commit b5411e28a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- compilation broken on freebsd ([#461](https://github.com/extrawurst/gitui/issues/461))
- dont fail if `user.name` is not set [[@cruessler](https://github.com/cruessler)] ([#79](https://github.com/extrawurst/gitui/issues/79)) ([#228](https://github.com/extrawurst/gitui/issues/228))
- set MacOS config directory to ~/.config [[@remique](https://github.com/remique)] ([#317](https://github.com/extrawurst/gitui/issues/317))
## [0.11.0] - 2020-12-20

View File

@ -9,7 +9,7 @@ This file allows changing every key binding.
The config file format based on the [Ron file format](https://github.com/ron-rs/ron).
The location of the file depends on your OS:
* `$HOME/Library/Application Support/gitui/key_config.ron` (mac)
* `$HOME/.config/gitui/key_config.ron` (mac)
* `$XDG_CONFIG_HOME/gitui/key_config.ron` (linux using XDG)
* `$HOME/.config/gitui/key_config.ron` (linux)

View File

@ -244,8 +244,12 @@ fn get_app_cache_path() -> Result<PathBuf> {
}
fn get_app_config_path() -> Result<PathBuf> {
let mut path = dirs_next::config_dir()
.ok_or_else(|| anyhow!("failed to find os config dir."))?;
let mut path = if cfg!(target_os = "macos") {
dirs_next::home_dir().map(|h| h.join(".config"))
} else {
dirs_next::config_dir()
}
.ok_or_else(|| anyhow!("failed to find os config dir."))?;
path.push("gitui");
fs::create_dir_all(&path)?;