cod_paths/lib.rs
1use anyhow::Context;
2use std::path::PathBuf;
3
4pub fn token_directory() -> anyhow::Result<PathBuf> {
5    dirs::data_dir()
6        .context("Couldn't find data directory for saving the token.")
7        .map(|data_dir| data_dir.join(".cod"))
8}
9
10pub fn token_path() -> anyhow::Result<PathBuf> {
11    token_directory().map(|token_dir| token_dir.join("TOKEN"))
12}