(&self, vm: &VirtualMachine)
| 735 | |
| 736 | #[pymethod] |
| 737 | fn is_symlink(&self, vm: &VirtualMachine) -> PyResult<bool> { |
| 738 | if let Ok(file_type) = &self.file_type { |
| 739 | return Ok(file_type.is_symlink()); |
| 740 | } |
| 741 | #[cfg(unix)] |
| 742 | if let Some(dt) = self.d_type |
| 743 | && dt != libc::DT_UNKNOWN |
| 744 | { |
| 745 | return Ok(dt == libc::DT_LNK); |
| 746 | } |
| 747 | #[cfg(unix)] |
| 748 | return self.test_mode_via_stat(false, libc::S_IFLNK as _, vm); |
| 749 | #[cfg(not(unix))] |
| 750 | match &self.file_type { |
| 751 | Err(e) if e.kind() == io::ErrorKind::NotFound => Ok(false), |
| 752 | Err(e) => { |
| 753 | use crate::convert::ToPyException; |
| 754 | Err(e.to_pyexception(vm)) |
| 755 | } |
| 756 | Ok(_) => Ok(false), |
| 757 | } |
| 758 | } |
| 759 | |
| 760 | #[pymethod] |
| 761 | fn stat( |
no test coverage detected