diff --git a/Cargo.toml b/Cargo.toml index d9e819d..17129c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,5 +12,8 @@ description = "Get the filesystem path of a file." [target.'cfg(target_os="macos")'.dependencies] libc = "0.2" +[target.'cfg(target_os="ios")'.dependencies] +libc = {version = "0.2", default_features = false} + [target.'cfg(windows)'.dependencies] winapi = { version = "0.3", features = ["std", "fileapi"] } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index d10530f..470c540 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ //! `filepath` contains an extension trait for `std::fs::File` providing a `path` method. //! -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "ios"))] extern crate libc; #[cfg(windows)] extern crate winapi; @@ -24,10 +24,10 @@ use std::os::unix::io::AsRawFd; #[cfg(windows)] use std::os::windows::io::AsRawHandle; -#[cfg(any(target_os = "macos", windows))] +#[cfg(any(target_os = "macos", target_os = "ios", windows))] use std::ffi::OsString; -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "ios"))] use std::os::unix::ffi::OsStringExt; #[cfg(windows)] use std::os::windows::prelude::*; @@ -35,7 +35,7 @@ use std::os::windows::prelude::*; #[cfg(windows)] use winapi::um::fileapi; -#[cfg(target_os = "macos")] +#[cfg(any(target_os = "macos", target_os = "ios"))] const F_GETPATH: i32 = 50; /// An extension trait for `std::fs::File` providing a `path` method. @@ -72,7 +72,7 @@ impl FilePath for File { read_link(path) } - #[cfg(target_os = "macos")] + #[cfg(any(target_os = "macos", target_os = "ios"))] fn path(&self) -> io::Result { let fd = self.as_raw_fd(); let mut path = vec![0; libc::PATH_MAX as usize + 1];