Re:Dijo: A terminal-based habit tracker written in Rust
by badrequest on Monday July 20, 2020 @03:22PM
(#23900995)
Where is this data stored? The Wiki completely glosses over this subject, and I cannot tell from the code where it might save anything to (to be fair, I have never written in rust).
[ Parent
| on HN ]
Re:Dijo: A terminal-based habit tracker written in Rust
by alias-dev on Monday July 20, 2020 @03:40PM
(#23901156)
They use the 'directories' crate (https://docs.rs/directories/3.0.1/directories/struct.Project...) to work out where the data directory should be, then write out to a json file. See 'src/utils.rs'
Re:Dijo: A terminal-based habit tracker written in Rust
by estebank on Monday July 20, 2020 @03:27PM
(#23901038)
Looks like it is stored in
Linux: /home/alice/.config/dijo/habit_record.json
Windows: C:\Users\Alice\AppData\Roaming\nerdypepper\dijo\habit_record.json
macOS: /Users/Alice/Library/Preferences/rs.nerdypepper.dijo/habit_record.json
https://github.com/NerdyPepper/dijo/blob/master/src/utils.rs...https://docs.rs/directories/0.8.5/directories/struct.Project...
Re:Dijo: A terminal-based habit tracker written in Rust
by p0llard on Monday July 20, 2020 @05:14PM
(#23901979)
I haven't run this, so perhaps the behaviour is different to what I'm expecting, but since it uses `XDG_DATA_HOME` (`data_dir` in the `directories` crate) I'd expect it to appear as
/home/alice/.local/share/dijo/habit_record.json
on XDG compliant Linux.
Re:Dijo: A terminal-based habit tracker written in Rust
by StavrosK on Monday July 20, 2020 @05:52PM
(#23902286)
That's where it is for me, and not under ~/.config. It's a bit puzzling, because that's where I expected it to be.
Re:Dijo: A terminal-based habit tracker written in Rust
by p0llard on Monday July 20, 2020 @06:26PM
(#23902531)
In general ~/.config is only for config; data should be in ~/.local/share, but a lot of programs get this wrong and abuse ~/.config using it for everything.
Even worse are the programs which use it to cache runtime data; I should be able to add the entire ~/.config to a dotfiles repo without accidentally including personal data (other than that which might reasonably appear in a config file) or ephemeral data.
Re:Dijo: A terminal-based habit tracker written in Rust
by StavrosK on Monday July 20, 2020 @06:28PM
(#23902544)
Fair enough, I guess this is actual program data rather than the config, you're right.
Re:Dijo: A terminal-based habit tracker written in Rust
by badrequest on Monday July 20, 2020 @03:38PM
(#23901140)
thank you!