Sha256: 3117b349ddcbc554757e0713bb8ace3423f78adc8ebee30dee50567372ff3d96

Contents?: true

Size: 1.05 KB

Versions: 36

Compression:

Stored size: 1.05 KB

Contents

use super::{internal_open, read_link_one};
use crate::fs::{open_unchecked, FollowSymlinks, MaybeOwnedFile, OpenOptions, OpenUncheckedError};
use std::ffi::OsStr;
use std::path::PathBuf;
use std::{fs, io};

pub(crate) fn open_entry(
    start: &fs::File,
    path: &OsStr,
    options: &OpenOptions,
) -> io::Result<fs::File> {
    match open_unchecked(
        start,
        path.as_ref(),
        options.clone().follow(FollowSymlinks::No),
    ) {
        Ok(file) => Ok(file),
        Err(OpenUncheckedError::Symlink(_, _)) if options.follow == FollowSymlinks::Yes => {
            let mut symlink_count = 0;
            let destination = read_link_one(start, path, &mut symlink_count, PathBuf::new())?;
            let maybe = MaybeOwnedFile::borrowed(start);
            internal_open(maybe, &destination, options, &mut symlink_count, None)
                .map(MaybeOwnedFile::unwrap_owned)
        }
        Err(OpenUncheckedError::NotFound(err))
        | Err(OpenUncheckedError::Other(err))
        | Err(OpenUncheckedError::Symlink(err, _)) => Err(err),
    }
}

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
wasmtime-27.0.0 ./ext/cargo-vendor/cap-primitives-3.4.1/src/fs/manually/open_entry.rs
wasmtime-26.0.0 ./ext/cargo-vendor/cap-primitives-3.3.0/src/fs/manually/open_entry.rs
wasmtime-25.0.2 ./ext/cargo-vendor/cap-primitives-3.2.0/src/fs/manually/open_entry.rs
wasmtime-25.0.1 ./ext/cargo-vendor/cap-primitives-3.2.0/src/fs/manually/open_entry.rs
wasmtime-25.0.0 ./ext/cargo-vendor/cap-primitives-3.2.0/src/fs/manually/open_entry.rs
wasmtime-24.0.0 ./ext/cargo-vendor/cap-primitives-3.2.0/src/fs/manually/open_entry.rs
wasmtime-23.0.2 ./ext/cargo-vendor/cap-primitives-3.1.0/src/fs/manually/open_entry.rs
wasmtime-22.0.0 ./ext/cargo-vendor/cap-primitives-3.1.0/src/fs/manually/open_entry.rs
wasmtime-21.0.1 ./ext/cargo-vendor/cap-primitives-3.1.0/src/fs/manually/open_entry.rs
wasmtime-20.0.2 ./ext/cargo-vendor/cap-primitives-3.1.0/src/fs/manually/open_entry.rs
wasmtime-20.0.0 ./ext/cargo-vendor/cap-primitives-3.0.0/src/fs/manually/open_entry.rs
wasmtime-18.0.3 ./ext/cargo-vendor/cap-primitives-2.0.1/src/fs/manually/open_entry.rs
wasmtime-17.0.1 ./ext/cargo-vendor/cap-primitives-2.0.1/src/fs/manually/open_entry.rs
wasmtime-17.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/fs/manually/open_entry.rs
wasmtime-16.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/fs/manually/open_entry.rs
wasmtime-15.0.1 ./ext/cargo-vendor/cap-primitives-2.0.1/src/fs/manually/open_entry.rs
wasmtime-15.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/fs/manually/open_entry.rs
wasmtime-14.0.4 ./ext/cargo-vendor/cap-primitives-2.0.0/src/fs/manually/open_entry.rs
wasmtime-14.0.3 ./ext/cargo-vendor/cap-primitives-2.0.0/src/fs/manually/open_entry.rs
wasmtime-14.0.1 ./ext/cargo-vendor/cap-primitives-2.0.0/src/fs/manually/open_entry.rs