wick_xdg/
directories.rs

1#![allow(clippy::option_if_let_else)]
2use std::path::{Path, PathBuf};
3
4#[derive(Debug, Clone, getset::Getters)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize))]
6/// A struct containing global and relative cache directories.
7pub struct Directories {
8  #[getset(get = "pub")]
9  /// The root data directory.
10  root: PathBuf,
11  #[getset(get = "pub")]
12  /// The directory to find and store processed data.
13  cache: PathBuf,
14  #[getset(get = "pub")]
15  /// The directory to find and store downloaded or unprocessed artifacts.
16  staging: PathBuf,
17}
18
19impl Directories {
20  pub(crate) fn new(root: &Path) -> Self {
21    Self {
22      root: root.to_path_buf(),
23      cache: root.join(crate::directory::CACHE),
24      staging: root.join(crate::directory::STAGING),
25    }
26  }
27}