MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / ln_force

Function ln_force

certbot/src/acme_client.rs:603–612  ·  view source on GitHub ↗
(src: impl AsRef<Path>, dst: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

601}
602
603fn ln_force(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> {
604 // Check if the symlink exists without following it
605 if dst.as_ref().symlink_metadata().is_ok() {
606 fs::remove_file(dst.as_ref())?;
607 } else if let Some(dst_parent) = dst.as_ref().parent() {
608 fs::create_dir_all(dst_parent)?;
609 }
610 fs::os::unix::fs::symlink(src.as_ref(), dst.as_ref())?;
611 Ok(())
612}
613
614#[cfg(test)]
615mod tests;

Callers 1

store_certMethod · 0.85

Calls 1

as_refMethod · 0.45

Tested by

no test coverage detected