zetzit / zz

πŸΊπŸ™ ZetZ a zymbolic verifier and tranzpiler to bare metal C
MIT License
1.6k stars 52 forks source link

Allow search path to be extended with environment variable #37

Closed jwerle closed 4 years ago

jwerle commented 4 years ago

Hi @aep,

What are your thoughts on allowing one the ability to add a path to the search paths HashSet with an environment variable? This could allow users to specify the location of their modules if they are not located in standard directories when running zz:

$ ZZ_PATH=./path/to/modules zz build

I think something like:

if let Ok(zz_path) = std::env::var("ZZ_MODULES_PATH") {
    let module_paths = zz_path.split(":");
    for path in module_paths {
        searchpaths.insert(std::path::Path::new(&path).to_path_buf());
    }
} 
aep commented 4 years ago

Yes this is a good idea, thanks for the suggestion

jwerle commented 4 years ago

Great! I issued an initial implementation in a PR (#38)