From a77624b8615a10d6aaba186dcd6bbb15b1419397 Mon Sep 17 00:00:00 2001 From: Naz Date: Sun, 27 Jul 2025 15:18:51 +0100 Subject: =?UTF-8?q?=E2=9C=A8feat:=20add=20executable=20symlink=20creation?= =?UTF-8?q?=20to=20~/.local/bin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/types.rs b/src/types.rs index b20ada1..f0cbfd4 100644 --- a/src/types.rs +++ b/src/types.rs @@ -69,6 +69,27 @@ impl AppImage { fs::set_permissions(&file_path, perms).await?; } + Ok(()) + } + pub async fn create_symlink(&self) -> Result<(), Box> { + let home = std::env::var("HOME")?; + let local_bin = PathBuf::from(home).join(".local/bin"); + + fs::create_dir_all(&local_bin).await?; + + let symlink_path = local_bin.join(&self.executable); + + #[cfg(unix)] + { + use tokio::fs; + + if symlink_path.exists() { + fs::remove_file(&symlink_path).await?; + } + + std::os::unix::fs::symlink(&self.file_path, &symlink_path)?; + } + Ok(()) } } -- cgit v1.2.3