Remove a symlink, handling both file and directory symlinks cross-platform. On Windows, directory symlinks require `fs::remove_dir()` instead of `fs::remove_file()`.
(path: &Path)
| 1701 | /// Remove a symlink, handling both file and directory symlinks cross-platform. |
| 1702 | /// On Windows, directory symlinks require `fs::remove_dir()` instead of `fs::remove_file()`. |
| 1703 | fn remove_symlink(path: &Path) -> std::io::Result<()> { |
| 1704 | #[cfg(windows)] |
| 1705 | { |
| 1706 | let meta = fs::symlink_metadata(path)?; |
| 1707 | if meta.file_type().is_symlink_dir() { |
| 1708 | return fs::remove_dir(path); |
| 1709 | } |
| 1710 | } |
| 1711 | fs::remove_file(path) |
| 1712 | } |
| 1713 | |
| 1714 | #[cfg(test)] |
| 1715 | mod tests { |
no outgoing calls
no test coverage detected