maolan_engine/plugins/
paths.rs1use std::path::PathBuf;
2
3pub fn home_dir() -> String {
4 std::env::var("HOME")
5 .or_else(|_| std::env::var("USERPROFILE"))
6 .unwrap_or_default()
7}
8
9pub fn push_macos_audio_plugin_roots(roots: &mut Vec<PathBuf>, plugin_dir_name: &str) {
10 roots.push(PathBuf::from(format!(
11 "/Library/Audio/Plug-Ins/{plugin_dir_name}"
12 )));
13 roots.push(PathBuf::from(format!(
14 "{}/Library/Audio/Plug-Ins/{plugin_dir_name}",
15 home_dir()
16 )));
17}
18
19pub fn push_unix_plugin_roots(roots: &mut Vec<PathBuf>, plugin_dir_name: &str) {
20 roots.push(PathBuf::from(format!("/usr/lib/{plugin_dir_name}")));
21 roots.push(PathBuf::from(format!("/usr/lib64/{plugin_dir_name}")));
22 roots.push(PathBuf::from(format!("/usr/local/lib/{plugin_dir_name}")));
23 roots.push(PathBuf::from(format!("/usr/local/lib64/{plugin_dir_name}")));
24 roots.push(PathBuf::from(format!("{}/.{plugin_dir_name}", home_dir())));
25 roots.push(PathBuf::from(format!(
26 "{}/.local/lib/{plugin_dir_name}",
27 home_dir()
28 )));
29}