use std::path::PathBuf;
pub mod dfdaemon;
pub mod dfget;
pub mod dfinit;
pub mod dfstore;
pub const SERVICE_NAME: &str = "dragonfly";
pub const NAME: &str = "client";
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
pub const CARGO_PKG_RUSTC_VERSION: &str = env!("CARGO_PKG_RUST_VERSION");
pub const GIT_HASH: Option<&str> = option_env!("GIT_HASH");
pub fn default_root_dir() -> PathBuf {
#[cfg(target_os = "linux")]
return PathBuf::from("/var/run/dragonfly/");
#[cfg(target_os = "macos")]
return home::home_dir().unwrap().join(".dragonfly");
}
pub fn default_config_dir() -> PathBuf {
#[cfg(target_os = "linux")]
return PathBuf::from("/etc/dragonfly/");
#[cfg(target_os = "macos")]
return home::home_dir().unwrap().join(".dragonfly").join("config");
}
pub fn default_log_dir() -> PathBuf {
#[cfg(target_os = "linux")]
return PathBuf::from("/var/log/dragonfly/");
#[cfg(target_os = "macos")]
return home::home_dir().unwrap().join(".dragonfly").join("logs");
}
pub fn default_storage_dir() -> PathBuf {
#[cfg(target_os = "linux")]
return PathBuf::from("/var/lib/dragonfly/");
#[cfg(target_os = "macos")]
return home::home_dir().unwrap().join(".dragonfly").join("storage");
}
pub fn default_lock_dir() -> PathBuf {
#[cfg(target_os = "linux")]
return PathBuf::from("/var/lock/dragonfly/");
#[cfg(target_os = "macos")]
return home::home_dir().unwrap().join(".dragonfly");
}
pub fn default_plugin_dir() -> PathBuf {
#[cfg(target_os = "linux")]
return PathBuf::from("/var/lib/dragonfly/plugins/");
#[cfg(target_os = "macos")]
return home::home_dir().unwrap().join(".dragonfly").join("plugins");
}
pub fn default_cache_dir() -> PathBuf {
#[cfg(target_os = "linux")]
return PathBuf::from("/var/cache/dragonfly/");
#[cfg(target_os = "macos")]
return home::home_dir().unwrap().join(".dragonfly").join("cache");
}
pub fn default_piece_length() -> u64 {
4 * 1024 * 1024
}