diff options
| author | Naz <ndpm13@ch-naseem.com> | 2025-07-29 16:28:14 +0100 |
|---|---|---|
| committer | Naz <ndpm13@ch-naseem.com> | 2025-07-29 16:28:14 +0100 |
| commit | 53cbca7ae6e3c1e37e59cafcd45efdba65c732ed (patch) | |
| tree | 1349cf1d3c6882446ffbe22103ec5a1d8f3d9e0a | |
| parent | 2cef21906b9bd3c2e92925d7c93d3c8053b52ade (diff) | |
🔧refactor: move the symlink removal logic to SymlinkManager
| -rw-r--r-- | src/symlink.rs | 8 |
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"); |
