|
@ -100,7 +100,7 @@ pub fn git_dir() -> Result<Option<PathBuf>> { |
|
|
/// Returns a `PathBuf` to the cache root for this project
|
|
|
/// Returns a `PathBuf` to the cache root for this project
|
|
|
///
|
|
|
///
|
|
|
/// This will be either the appropriate cache dir according to XDG or as a fallback `/tmp`.
|
|
|
/// This will be either the appropriate cache dir according to XDG or as a fallback `/tmp`.
|
|
|
pub fn chache_root() -> PathBuf {
|
|
|
|
|
|
|
|
|
pub fn cache_root() -> PathBuf {
|
|
|
match ProjectDirs::from("org", "webschneider", env!("CARGO_PKG_NAME")) {
|
|
|
match ProjectDirs::from("org", "webschneider", env!("CARGO_PKG_NAME")) {
|
|
|
Some(dirs) => PathBuf::from(dirs.cache_dir()),
|
|
|
Some(dirs) => PathBuf::from(dirs.cache_dir()),
|
|
|
None => "/tmp".into(),
|
|
|
None => "/tmp".into(),
|
|
@ -109,7 +109,7 @@ pub fn chache_root() -> PathBuf { |
|
|
|
|
|
|
|
|
/// Returns a default file cache
|
|
|
/// Returns a default file cache
|
|
|
pub fn default_cache() -> Result<FileCache> {
|
|
|
pub fn default_cache() -> Result<FileCache> {
|
|
|
let cache_root = crate::helpers::chache_root();
|
|
|
|
|
|
|
|
|
let cache_root = crate::helpers::cache_root();
|
|
|
FileCache::new(&cache_root, std::time::Duration::from_secs(60 * 24 * 2))
|
|
|
FileCache::new(&cache_root, std::time::Duration::from_secs(60 * 24 * 2))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|