summaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
authorStephan Dilly <dilly.stephan@gmail.com>2021-05-17 00:17:01 +0200
committerStephan Dilly <dilly.stephan@gmail.com>2021-05-17 00:17:01 +0200
commitfce294066c2734f6271386cd04854f9120edbaa1 (patch)
tree3b21817f8a6fc4be4f594d7e31fe5842e87ac1dd /src/args.rs
parente03ae0f93137cfd0a5e3c152469a35f9151fb2bb (diff)
fix logging broken in d4455a2
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs11
1 files changed, 10 insertions, 1 deletions
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<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"))