summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiziano Santoro <tiziano88@gmail.com>2019-07-24 17:55:37 +0100
committerAndrew Gallant <jamslam@gmail.com>2019-07-24 12:55:37 -0400
commit9801fae29f5a6d1c72a73e5f343f50130b09f646 (patch)
treec4168b73c66e75b60061cf0a47d03abba670ac63
parentabdf7140d73c275cd7c2eca38db6309b902c3e5d (diff)
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
-rw-r--r--ignore/src/walk.rs24
1 files changed, 23 insertions, 1 deletions
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<DirEntryRaw, Error> {
+ 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<DirEntryRaw, Error> {
+ Err(Error::Io(io::Error::new(
+ io::ErrorKind::Other, "unsupported platform")))
+ }
}
/// WalkBuilder builds a recursive directory iterator.