use std::path::PathBuf;
pub fn resolve_cache_dir(override_dir: Option<PathBuf>) -> Option<PathBuf> {
resolve_cache_dir_with_source(override_dir).0
}
pub fn resolve_cache_dir_with_source(
override_dir: Option<PathBuf>,
) -> (Option<PathBuf>, crate::config::PathSource) {
use crate::config::PathSource;
if let Some(p) = override_dir {
return (Some(p), PathSource::CliFlag);
}
if let Some(p) = directories::ProjectDirs::from("", "", crate::config::APP_NAME)
.map(|d| d.cache_dir().to_path_buf())
{
return (Some(p), PathSource::Xdg);
}
(None, PathSource::Unresolved)
}