Macro app_path

Source
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 to AppPath::new())
  • app_path!(path) - Simple path creation (equivalent to AppPath::with(path))
  • app_path!(path, env = "VAR_NAME") - With environment variable override
  • app_path!(path, override = expression) - With optional override expression
  • app_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));