Skip to content

Commit 7df1d03

Browse files
authored
Merge pull request #1545 from ChanTsune/gix-config-value-for-wasi
Support compile `gix-config-value` to wasm32-wasi
2 parents c3f173c + b94eeb5 commit 7df1d03

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ jobs:
209209
- name: Install Rust
210210
run: rustup update stable && rustup default stable && rustup target add ${{ matrix.target }}
211211
- uses: Swatinem/rust-cache@v2
212-
- run: set +x; for name in gix-actor gix-attributes gix-bitmap gix-chunk gix-command gix-commitgraph gix-date gix-glob gix-hash gix-hashtable gix-mailmap gix-object gix-packetline gix-path gix-quote gix-refspec gix-revision gix-traverse gix-validate; do (cd $name && cargo build --target ${{ matrix.target }}); done
212+
- run: set +x; for name in gix-actor gix-attributes gix-bitmap gix-chunk gix-command gix-commitgraph gix-config-value gix-date gix-glob gix-hash gix-hashtable gix-mailmap gix-object gix-packetline gix-path gix-pathspec gix-prompt gix-quote gix-refspec gix-revision gix-traverse gix-validate; do (cd $name && cargo build --target ${{ matrix.target }}); done
213213
name: crates without feature toggles
214214
- run: set +x; for feature in progress fs-walkdir-parallel parallel io-pipe crc32 zlib zlib-rust-backend fast-sha1 rustsha1 cache-efficiency-debug; do (cd gix-features && cargo build --features $feature --target ${{ matrix.target }}); done
215215
name: features of gix-features

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)