Improve error message when WASMER_DIR is not set

This commit is contained in:
Mark McCaskey
2020-10-12 13:51:03 -07:00
parent c6460d1d77
commit 21c1770426

View File

@@ -151,15 +151,21 @@ impl CreateExe {
} }
} }
fn get_wasmer_dir() -> anyhow::Result<PathBuf> {
Ok(PathBuf::from(
env::var("WASMER_DIR").context("Trying to read env var `WASMER_DIR`")?,
))
}
fn get_wasmer_include_directory() -> anyhow::Result<PathBuf> { fn get_wasmer_include_directory() -> anyhow::Result<PathBuf> {
let mut path = PathBuf::from(env::var("WASMER_DIR")?); let mut path = get_wasmer_dir()?;
path.push("include"); path.push("include");
Ok(path) Ok(path)
} }
/// path to the static libwasmer /// path to the static libwasmer
fn get_libwasmer_path() -> anyhow::Result<PathBuf> { fn get_libwasmer_path() -> anyhow::Result<PathBuf> {
let mut path = PathBuf::from(env::var("WASMER_DIR")?); let mut path = get_wasmer_dir()?;
path.push("lib"); path.push("lib");
#[cfg(not(windows))] #[cfg(not(windows))]