diff --git a/src/args.rs b/src/args.rs index 765e11c5..9ff40870 100644 --- a/src/args.rs +++ b/src/args.rs @@ -74,7 +74,7 @@ pub fn process_cmdline() -> Result { } fn setup_logging() -> Result<()> { - let mut path = get_app_config_path()?; + let mut path = get_app_cache_path()?; path.push("gitui.log"); let _ = WriteLogger::init( @@ -86,6 +86,15 @@ fn setup_logging() -> Result<()> { Ok(()) } +fn get_app_cache_path() -> Result { + let mut path = dirs_next::cache_dir() + .ok_or_else(|| anyhow!("failed to find os cache dir."))?; + + path.push("gitui"); + fs::create_dir_all(&path)?; + Ok(path) +} + pub fn get_app_config_path() -> Result { let mut path = if cfg!(target_os = "macos") { dirs_next::home_dir().map(|h| h.join(".config"))