// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use os::unix::prelude::*;
use ffi::{CString, CStr, OsString, OsStr};
stat(&self.path()).map(|m| m.file_type())
}
- #[cfg(not(target_os = "solaris"))]
+ #[cfg(target_os = "haiku")]
+ pub fn file_type(&self) -> io::Result<FileType> {
+ lstat(&self.path()).map(|m| m.file_type())
+ }
+
+ #[cfg(not(any(target_os = "solaris", target_os = "haiku")))]
pub fn file_type(&self) -> io::Result<FileType> {
match self.entry.d_type {
libc::DT_CHR => Ok(FileType { mode: libc::S_IFCHR }),
target_os = "linux",
target_os = "emscripten",
target_os = "android",
- target_os = "solaris"))]
+ target_os = "solaris",
+ target_os = "haiku"))]
pub fn ino(&self) -> u64 {
self.entry.d_ino as u64
}
}
#[cfg(any(target_os = "android",
target_os = "linux",
- target_os = "emscripten"))]
+ target_os = "emscripten",
+ target_os = "haiku"))]
fn name_bytes(&self) -> &[u8] {
unsafe {
CStr::from_ptr(self.entry.d_name.as_ptr()).to_bytes()
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[cfg(target_os = "linux")]
fn get_path(fd: c_int) -> Option<PathBuf> {
- use string::ToString;
let mut p = PathBuf::from("/proc/self/fd");
p.push(&fd.to_string());
readlink(&p).ok()