1#[cfg(not(target_arch = "wasm32"))]
2use std::path::PathBuf;
3
4#[cfg(not(target_arch = "wasm32"))]
5pub mod package_cache;
6#[cfg(not(target_arch = "wasm32"))]
7pub mod run_exports_cache;
8
9#[cfg(not(target_arch = "wasm32"))]
10pub mod validation;
11
12mod consts;
13pub use consts::{PACKAGE_CACHE_DIR, REPODATA_CACHE_DIR, RUN_EXPORTS_CACHE_DIR};
14
15#[cfg(not(target_arch = "wasm32"))]
19pub fn default_cache_dir() -> anyhow::Result<PathBuf> {
20 std::env::var("RATTLER_CACHE_DIR")
21 .map(PathBuf::from)
22 .or_else(|_| {
23 dirs::cache_dir()
24 .ok_or_else(|| {
25 anyhow::anyhow!("could not determine cache directory for current platform")
26 })
27 .map(|mut p| {
29 p.push("rattler");
30 p.push("cache");
31 p
32 })
33 })
34}