(
path: OsPath,
dir_fd: DirFd<'_, { RMDIR_DIR_FD as usize }>,
vm: &VirtualMachine,
)
| 375 | #[cfg(not(windows))] |
| 376 | #[pyfunction] |
| 377 | fn rmdir( |
| 378 | path: OsPath, |
| 379 | dir_fd: DirFd<'_, { RMDIR_DIR_FD as usize }>, |
| 380 | vm: &VirtualMachine, |
| 381 | ) -> PyResult<()> { |
| 382 | #[cfg(not(target_os = "redox"))] |
| 383 | if let Some(fd) = dir_fd.raw_opt() { |
| 384 | let c_path = path.clone().into_cstring(vm)?; |
| 385 | let res = unsafe { libc::unlinkat(fd, c_path.as_ptr(), libc::AT_REMOVEDIR) }; |
| 386 | return if res < 0 { |
| 387 | let err = crate::common::os::errno_io_error(); |
| 388 | Err(OSErrorBuilder::with_filename(&err, path, vm)) |
| 389 | } else { |
| 390 | Ok(()) |
| 391 | }; |
| 392 | } |
| 393 | #[cfg(target_os = "redox")] |
| 394 | let [] = dir_fd.0; |
| 395 | fs::remove_dir(&path).map_err(|err| OSErrorBuilder::with_filename(&err, path, vm)) |
| 396 | } |
| 397 | |
| 398 | #[cfg(windows)] |
| 399 | #[pyfunction] |
nothing calls this directly
no test coverage detected