From b5411e28a5e31ea4bb80ddc5f3fe32c824f59af0 Mon Sep 17 00:00:00 2001 From: remique <44347542+remique@users.noreply.github.com> Date: Tue, 16 Feb 2021 22:52:32 +0100 Subject: [PATCH] Set MacOS config directory to ~/.config (#379) --- CHANGELOG.md | 1 + KEY_CONFIG.md | 2 +- src/main.rs | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c7c6acd..1d49499e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) - don’t 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 diff --git a/KEY_CONFIG.md b/KEY_CONFIG.md index 3841dc93..9e88722e 100644 --- a/KEY_CONFIG.md +++ b/KEY_CONFIG.md @@ -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) diff --git a/src/main.rs b/src/main.rs index e1e45ec0..47972eae 100644 --- a/src/main.rs +++ b/src/main.rs @@ -244,8 +244,12 @@ fn get_app_cache_path() -> Result { } fn get_app_config_path() -> Result { - 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)?;