1use std::{
2 env::consts::ARCH,
3 path::{Path, PathBuf},
4 sync::OnceLock,
5};
6
7use directories::ProjectDirs;
8
9pub fn data_dir() -> &'static Path {
10 static DATA_DIR: OnceLock<PathBuf> = OnceLock::new();
11 DATA_DIR.get_or_init(|| {
12 ProjectDirs::from("", "vector", "vdev")
13 .expect("Could not determine the project directory")
14 .data_local_dir()
15 .to_path_buf()
16 })
17}
18
19pub fn default_target() -> String {
20 if cfg!(windows) {
21 format!("{ARCH}-pc-windows-msvc")
22 } else if cfg!(target_os = "macos") {
23 format!("{ARCH}-apple-darwin")
24 } else {
25 format!("{ARCH}-unknown-linux-gnu")
26 }
27}
28
29pub fn default_features() -> &'static str {
30 if cfg!(windows) {
31 "default-msvc"
32 } else {
33 "default"
34 }
35}