trifid/tfclient/src/dirs.rs

44 lines
1.3 KiB
Rust
Raw Normal View History

use std::path::PathBuf;
2023-06-26 02:00:36 +00:00
#[cfg(target_os = "linux")]
pub fn config_base() -> PathBuf {
PathBuf::from("/etc/tfclient")
}
2023-06-26 02:00:36 +00:00
#[cfg(target_os = "windows")]
pub fn config_base() -> PathBuf {
PathBuf::from("C:\\Program Data\\e3team\\tfclient")
}
2023-06-26 02:00:36 +00:00
#[cfg(target_os = "macos")]
pub fn config_base() -> PathBuf {
PathBuf::from("/Library/Application Support/e3team/tfclient")
}
2023-06-26 02:00:36 +00:00
#[cfg(target_os = "ios")]
compile_error!("tfclient cannot be compiled for iOS");
#[cfg(target_os = "android")]
compile_error!("tfclient cannot be compiled for Android");
#[cfg(target_os = "freebsd")]
pub fn config_base() -> PathBuf {
PathBuf::from("/etc/tfclient")
}
#[cfg(target_os = "dragonfly")]
compile_error!("tfclient cannot be compiled for dragonfly");
#[cfg(target_os = "openbsd")]
compile_error!("tfclient cannot be compiled for openbsd");
#[cfg(target_os = "netbsd")]
compile_error!("tfclient cannot be compiled for netbsd");
2023-06-26 02:00:36 +00:00
pub fn config_dir(instance: &str) -> PathBuf {
config_base().join(format!("{}/", instance))
}
2023-06-26 02:00:36 +00:00
pub fn tfclient_toml(instance: &str) -> PathBuf {
config_base().join(format!("{}/", instance)).join("tfclient.toml")
}
2023-06-26 02:00:36 +00:00
pub fn tfdata_toml(instance: &str) -> PathBuf {
config_base().join(format!("{}/", instance)).join("tfdata.toml")
2023-05-14 17:47:49 +00:00
}
2023-06-26 02:00:36 +00:00
pub fn nebula_yml(instance: &str) -> PathBuf {
config_base().join(format!("{}/", instance)).join("nebula.yml")
}