MCPcopy Create free account
hub / github.com/bootc-dev/bootc / read_dir_optional

Function read_dir_optional

crates/ostree-ext/src/bootabletree.rs:47–56  ·  view source on GitHub ↗
(
    d: &Dir,
    p: impl AsRef<Path>,
)

Source from the content-addressed store, hash-verified

45}
46
47fn read_dir_optional(
48 d: &Dir,
49 p: impl AsRef<Path>,
50) -> std::io::Result<Option<cap_std::fs::ReadDir>> {
51 match d.read_dir(p.as_ref()) {
52 Ok(r) => Ok(Some(r)),
53 Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(None),
54 Err(e) => Err(e),
55 }
56}
57
58/// Find the kernel modules directory in checked out directory tree.
59/// The target directory will have a `vmlinuz` file representing the kernel binary.

Callers 1

find_kernel_dir_fsFunction · 0.85

Calls 2

as_refMethod · 0.45
kindMethod · 0.45

Tested by

no test coverage detected