MCPcopy Create free account
hub / github.com/dallay/agentsync / remove_symlink

Function remove_symlink

src/linker.rs:1703–1712  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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()`.
1703fn 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)]
1715mod tests {

Callers 3

create_symlinkMethod · 0.85
cleanMethod · 0.85
remove_existing_pathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected