Skip to content

Commit adc9e31

Browse files
committed
fix: gix-config-value support compile target wasm32-wasi and wasm32-unknown-unknown
1 parent c3f173c commit adc9e31

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

gix-config-value/src/path.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@ pub mod interpolate {
5252
/// or any other error occurred.
5353
/// It can be used as `home_for_user` parameter in [`Path::interpolate()`][crate::Path::interpolate()].
5454
#[cfg_attr(windows, allow(unused_variables))]
55+
#[cfg_attr(all(target_family = "wasm", not(target_os = "emscripten")), allow(unused_variables))]
5556
pub fn home_for_user(name: &str) -> Option<PathBuf> {
56-
#[cfg(not(any(target_os = "android", target_os = "windows")))]
57+
#[cfg(not(any(
58+
target_os = "android",
59+
target_os = "windows",
60+
all(target_family = "wasm", not(target_os = "emscripten"))
61+
)))]
5762
{
5863
let cname = std::ffi::CString::new(name).ok()?;
5964
// SAFETY: calling this in a threaded program that modifies the pw database is not actually safe.
@@ -71,7 +76,11 @@ pub mod interpolate {
7176
Some(std::ffi::OsStr::from_bytes(cstr.to_bytes()).into())
7277
}
7378
}
74-
#[cfg(any(target_os = "android", target_os = "windows"))]
79+
#[cfg(any(
80+
target_os = "android",
81+
target_os = "windows",
82+
all(target_family = "wasm", not(target_os = "emscripten"))
83+
))]
7584
{
7685
None
7786
}

0 commit comments

Comments
 (0)