pub fn resolve_xml_path(xml: Option<&str>) -> Result<PathBuf, Box<dyn Error>>
Expand description

Resolve XML path from either:

  • provided argument,
  • default location (xml/, XML/, ../xml or ../XML) or
  • env_variable (LOCKSTEP_XML_PATH)

If no XML path is provided, it tries to find the default XML path. If the environment variable is set, it overrides the default, or argument path.

§Example

// path to XML files
std::env::set_var("LOCKSTEP_XML_PATH", "../xml");

let xml_path = resolve_xml_path(None).unwrap();
assert_eq!(xml_path, PathBuf::from("../xml").canonicalize().unwrap());       

§Panics

Panics if no XML path is provided and the default XML path is not found.