Skip to main content

resolve_resource_path

Function resolve_resource_path 

Source
pub fn resolve_resource_path(path: impl AsRef<Path>) -> PathBuf
Expand description

Resolves a resource path for the running binary.

Absolute paths are returned untouched. A relative path is first looked for next to the executable — where crate::copy_res_to_output_dir puts res/ at build time — so a binary finds its assets no matter what the working directory is. If nothing is there, the path is returned unchanged and stays relative to the working directory, which is what cargo run from a package root relies on.