Sha256: 022c44d2592d8abd9f69eac2598652293020b3272a243ab5a8d3ea7c49531982

Contents?: true

Size: 633 Bytes

Versions: 36

Compression:

Stored size: 633 Bytes

Contents

//! `get_path` translation code for macOS derived from Rust's
//! library/std/src/sys/unix/fs.rs at revision
//! 108e90ca78f052c0c1c49c42a22c85620be19712.

use crate::rustix::fs::file_path_by_ttyname_or_seaching;
use rustix::fs::getpath;
use std::ffi::OsString;
use std::fs;
#[cfg(unix)]
use std::os::unix::ffi::OsStringExt;
#[cfg(target_os = "wasi")]
use std::os::wasi::ffi::OsStringExt;
use std::path::PathBuf;

pub(crate) fn file_path(file: &fs::File) -> Option<PathBuf> {
    if let Ok(path) = getpath(file) {
        return Some(OsString::from_vec(path.into_bytes()).into());
    }

    file_path_by_ttyname_or_seaching(file)
}

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/rustix/darwin/fs/file_path.rs
wasmtime-26.0.0 ./ext/cargo-vendor/cap-primitives-3.3.0/src/rustix/darwin/fs/file_path.rs
wasmtime-25.0.2 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/darwin/fs/file_path.rs
wasmtime-25.0.1 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/darwin/fs/file_path.rs
wasmtime-25.0.0 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/darwin/fs/file_path.rs
wasmtime-24.0.0 ./ext/cargo-vendor/cap-primitives-3.2.0/src/rustix/darwin/fs/file_path.rs
wasmtime-23.0.2 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/darwin/fs/file_path.rs
wasmtime-22.0.0 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/darwin/fs/file_path.rs
wasmtime-21.0.1 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/darwin/fs/file_path.rs
wasmtime-20.0.2 ./ext/cargo-vendor/cap-primitives-3.1.0/src/rustix/darwin/fs/file_path.rs
wasmtime-20.0.0 ./ext/cargo-vendor/cap-primitives-3.0.0/src/rustix/darwin/fs/file_path.rs
wasmtime-18.0.3 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/darwin/fs/file_path.rs
wasmtime-17.0.1 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/darwin/fs/file_path.rs
wasmtime-17.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/darwin/fs/file_path.rs
wasmtime-16.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/darwin/fs/file_path.rs
wasmtime-15.0.1 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/darwin/fs/file_path.rs
wasmtime-15.0.0 ./ext/cargo-vendor/cap-primitives-2.0.1/src/rustix/darwin/fs/file_path.rs
wasmtime-14.0.4 ./ext/cargo-vendor/cap-primitives-2.0.0/src/rustix/darwin/fs/file_path.rs
wasmtime-14.0.3 ./ext/cargo-vendor/cap-primitives-2.0.0/src/rustix/darwin/fs/file_path.rs
wasmtime-14.0.1 ./ext/cargo-vendor/cap-primitives-2.0.0/src/rustix/darwin/fs/file_path.rs