Skip to content

Commit

Permalink
Don't resolve home on wasm32
Browse files Browse the repository at this point in the history
  • Loading branch information
basile-henry committed Dec 6, 2021
1 parent 367f41d commit 7e9b709
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dhall/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ path = "tests/spec.rs"
annotate-snippets = "0.9.0"
elsa = "1.3.2"
hex = "0.4.2"
home = "0.5.3"
itertools = "0.9.0"
lazy_static = "1.4.0"
once_cell = "1.3.1"
Expand All @@ -39,6 +38,7 @@ url = "2.1"
# wasm for now.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
reqwest = { version = "0.11", features = ["blocking"], optional = true }
home = "0.5.3"

[dev-dependencies]
anyhow = "1.0.28"
Expand Down
6 changes: 6 additions & 0 deletions dhall/src/semantics/resolve/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ impl Canonicalize for FilePath {
}
}

#[cfg(not(target_arch = "wasm32"))]
pub(crate) fn resolve_home(path: impl AsRef<Path>) -> Result<PathBuf, Error> {
let mut f = PathBuf::new();

Expand All @@ -635,6 +636,11 @@ pub(crate) fn resolve_home(path: impl AsRef<Path>) -> Result<PathBuf, Error> {
Ok(f)
}

#[cfg(target_arch = "wasm32")]
pub(crate) fn resolve_home(_path: impl AsRef<Path>) -> Result<PathBuf, Error> {
panic!("Imports relative to home are not supported on wasm yet");
}

impl<SE: Copy> Canonicalize for ImportTarget<SE> {
fn canonicalize(&self) -> ImportTarget<SE> {
match self {
Expand Down

0 comments on commit 7e9b709

Please sign in to comment.