Document hammond-data/src/lib.rs xdg_dirs module.

This commit is contained in:
Jordan Petridis 2017-11-28 09:24:12 +02:00
parent 76f9f36609
commit 7dd8755bcb
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -1,4 +1,5 @@
#![recursion_limit = "1024"]
#![warn(missing_docs)]
#![cfg_attr(feature = "cargo-clippy", allow(blacklisted_name))]
#[macro_use]
@ -25,9 +26,11 @@ extern crate rss;
extern crate url;
extern crate xdg;
#[allow(missing_docs)]
pub mod dbqueries;
pub mod utils;
pub mod feed;
#[allow(missing_docs)]
pub mod errors;
pub(crate) mod database;
pub(crate) mod models;
@ -36,27 +39,32 @@ mod schema;
pub use models::queryables::{Episode, Podcast, Source};
/// [XDG Base Direcotory](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) Paths.
pub mod xdg_dirs {
use std::path::PathBuf;
use xdg;
lazy_static!{
pub static ref HAMMOND_XDG: xdg::BaseDirectories = {
pub(crate) static ref HAMMOND_XDG: xdg::BaseDirectories = {
xdg::BaseDirectories::with_prefix("hammond").unwrap()
};
/// XDG_DATA Directory `Pathbuf`.
pub static ref HAMMOND_DATA: PathBuf = {
HAMMOND_XDG.create_data_directory(HAMMOND_XDG.get_data_home()).unwrap()
};
/// XDG_CONFIG Directory `Pathbuf`.
pub static ref HAMMOND_CONFIG: PathBuf = {
HAMMOND_XDG.create_config_directory(HAMMOND_XDG.get_config_home()).unwrap()
};
/// XDG_CACHE Directory `Pathbuf`.
pub static ref HAMMOND_CACHE: PathBuf = {
HAMMOND_XDG.create_cache_directory(HAMMOND_XDG.get_cache_home()).unwrap()
};
/// Hammond Download Direcotry `PathBuf`.
pub static ref DL_DIR: PathBuf = {
HAMMOND_XDG.create_data_directory("Downloads").unwrap()
};