mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-06-04 05:57:39 +02:00
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
This commit is contained in:
parent
abdf7140d7
commit
9801fae29f
@ -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(
|
fn from_path(
|
||||||
depth: usize,
|
depth: usize,
|
||||||
pb: PathBuf,
|
pb: PathBuf,
|
||||||
@ -416,6 +427,17 @@ impl DirEntryRaw {
|
|||||||
ino: md.ino(),
|
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.
|
/// WalkBuilder builds a recursive directory iterator.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user