From 9801fae29f5a6d1c72a73e5f343f50130b09f646 Mon Sep 17 00:00:00 2001 From: Tiziano Santoro Date: Wed, 24 Jul 2019 17:55:37 +0100 Subject: [PATCH] ignore: support compilation on wasm Currently the crate assumes that exactly one of `cfg(windows)` or `cfg(unix)` is true, but this is not actually the case, for instance when compiling for `wasm32`. Implement the missing functions so that the crate can compile on other platforms, even though those functions will always return an error. PR #1327 --- ignore/src/walk.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ignore/src/walk.rs b/ignore/src/walk.rs index 57f795c1..df796d41 100644 --- a/ignore/src/walk.rs +++ b/ignore/src/walk.rs @@ -379,7 +379,18 @@ impl DirEntryRaw { }) } - #[cfg(not(unix))] + // Placeholder implementation to allow compiling on non-standard platforms (e.g. wasm32). + #[cfg(not(any(windows, unix)))] + fn from_entry_os( + depth: usize, + ent: &fs::DirEntry, + ty: fs::FileType, + ) -> Result { + Err(Error::Io(io::Error::new( + io::ErrorKind::Other, "unsupported platform"))) + } + + #[cfg(windows)] fn from_path( depth: usize, pb: PathBuf, @@ -416,6 +427,17 @@ impl DirEntryRaw { ino: md.ino(), }) } + + // Placeholder implementation to allow compiling on non-standard platforms (e.g. wasm32). + #[cfg(not(any(windows, unix)))] + fn from_path( + depth: usize, + pb: PathBuf, + link: bool, + ) -> Result { + Err(Error::Io(io::Error::new( + io::ErrorKind::Other, "unsupported platform"))) + } } /// WalkBuilder builds a recursive directory iterator.