summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaz <ndpm13@ch-naseem.com>2025-07-29 16:28:14 +0100
committerNaz <ndpm13@ch-naseem.com>2025-07-29 16:28:14 +0100
commit53cbca7ae6e3c1e37e59cafcd45efdba65c732ed (patch)
tree1349cf1d3c6882446ffbe22103ec5a1d8f3d9e0a
parent2cef21906b9bd3c2e92925d7c93d3c8053b52ade (diff)
🔧refactor: move the symlink removal logic to SymlinkManager
-rw-r--r--src/symlink.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/symlink.rs b/src/symlink.rs
index 3883172..843115c 100644
--- a/src/symlink.rs
+++ b/src/symlink.rs
@@ -10,6 +10,14 @@ impl SymlinkManager {
pub fn new() -> Self {
Self {}
}
+ pub async fn remove(&self, executable: &str) -> Result<(), Box<dyn std::error::Error>> {
+ let home = std::env::var("HOME")?;
+ let symlink_path = PathBuf::from(home).join(".local/bin").join(executable);
+
+ fs::remove_file(symlink_path).await?;
+
+ Ok(())
+ }
pub async fn create(&self, appimage: &AppImage) -> Result<(), Box<dyn std::error::Error>> {
let home = std::env::var("HOME")?;
let local_bin = PathBuf::from(home).join(".local/bin");