Skip to content

Commit 39479c5

Browse files
author
Stephan Dilly
committed
use xdg convention for log file location putting it in .cache (see #27)
1 parent aa1c54d commit 39479c5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ cargo install gitui
6363

6464
# diagnostics:
6565

66-
to enable logging to `~/.gitui/gitui.log`:
66+
to enable logging:
6767
```
6868
GITUI_LOGGING=true gitui
6969
```
7070

71+
this will log to:
72+
* `$HOME/Library/Caches/gitui/gitui.log` (mac)
73+
* `$XDG_CACHE_HOME/gitui/gitui.log` (linux using `XDG`)
74+
* `$HOME/.cache/gitui/gitui.log` (linux)
75+
7176
# inspiration
7277

7378
* https://github.com/jesseduffield/lazygit

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ fn start_terminal<W: Write>(
152152

153153
fn setup_logging() {
154154
if env::var("GITUI_LOGGING").is_ok() {
155-
let mut path = dirs::home_dir().unwrap();
156-
path.push(".gitui");
155+
let mut path = dirs::cache_dir().unwrap();
156+
path.push("gitui");
157157
path.push("gitui.log");
158158
fs::create_dir(path.parent().unwrap()).unwrap_or_default();
159159

0 commit comments

Comments
 (0)