gravel_core/
paths.rs

1use gravel_ffi::paths;
2use lazy_static::lazy_static;
3use std::env::{self, consts::DLL_EXTENSION};
4use std::path::PathBuf;
5
6const APP_NAME: &str = "gravel";
7
8pub fn config_dir() -> PathBuf {
9	if let Ok(path) = env::var("GRAVEL_CONFIG_PATH") {
10		return path.into();
11	}
12
13	paths::xdg_config_home().join(APP_NAME)
14}
15
16pub fn log_path() -> PathBuf {
17	let mut path = paths::xdg_state_home();
18	path.push(APP_NAME);
19	path.push(APP_NAME);
20	path.set_extension("log");
21
22	path
23}
24
25pub fn plugin_globs() -> impl Iterator<Item = PathBuf> {
26	lazy_static! {
27		static ref PLUGIN_DIR: String = format!("{APP_NAME}/plugins/*.{DLL_EXTENSION}");
28	}
29
30	paths::xdg_data_globs(&PLUGIN_DIR)
31}