trifid/tfclient/src/dirs.rs

50 lines
1.3 KiB
Rust
Raw Normal View History

use std::path::PathBuf;
2023-07-12 15:47:38 +00:00
#[cfg(any(target_os = "linux", target_os = "netbsd"))]
2023-06-26 02:00:36 +00:00
pub fn config_base() -> PathBuf {
PathBuf::from("/etc/tfclient")
}
2023-07-12 15:47:38 +00:00
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");
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 {
2023-11-23 20:23:52 +00:00
config_base()
.join(format!("{}/", instance))
.join("tfclient.toml")
}
2023-06-26 02:00:36 +00:00
pub fn tfdata_toml(instance: &str) -> PathBuf {
2023-11-23 20:23:52 +00:00
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 {
2023-11-23 20:23:52 +00:00
config_base()
.join(format!("{}/", instance))
.join("nebula.yml")
2023-07-12 15:47:38 +00:00
}