macro_rules! app_path {
() => { ... };
($path:expr) => { ... };
($path:expr, env = $env_var:expr) => { ... };
($path:expr, override = $override_expr:expr) => { ... };
($path:expr, fn = $override_fn:expr) => { ... };
}
Expand description
Convenience macro for creating AppPath
instances with optional environment variable overrides.
§Syntax
app_path!()
- Application base directory (equivalent toAppPath::new()
)app_path!(path)
- Simple path creation (equivalent toAppPath::with(path)
)app_path!(path, env = "VAR_NAME")
- With environment variable overrideapp_path!(path, override = expression)
- With optional override expressionapp_path!(path, fn = function)
- With function-based override logic
§Examples
use app_path::app_path;
let config = app_path!("config.toml");
let data_dir = app_path!("data", env = "DATA_DIR");
let log_file = app_path!("app.log", override = std::env::args().nth(1));