fix logging broken in d4455a2

This commit is contained in:
Stephan Dilly 2021-05-17 00:17:01 +02:00
parent e03ae0f931
commit fce294066c

View file

@ -74,7 +74,7 @@ pub fn process_cmdline() -> Result<CliArgs> {
}
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<PathBuf> {
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<PathBuf> {
let mut path = if cfg!(target_os = "macos") {
dirs_next::home_dir().map(|h| h.join(".config"))