summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaz <ndpm13@ch-naseem.com>2025-07-29 16:26:28 +0100
committerNaz <ndpm13@ch-naseem.com>2025-07-29 16:26:28 +0100
commitcd49bc9362c0fef2534948d368c8c52460558a77 (patch)
tree998657678974615a649d67f7f69deebffd14e139
parentbd8adb9f0193f1482ca866b06cf133ff68fd9a8e (diff)
🔧refactor: move the path preparing logic to Downloader
-rw-r--r--src/downloader.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/downloader.rs b/src/downloader.rs
index c40b0b4..2196e25 100644
--- a/src/downloader.rs
+++ b/src/downloader.rs
@@ -11,6 +11,15 @@ impl Downloader {
pub fn new() -> Self {
Self {}
}
+ pub fn prepare_path(&self, url: &str, executable: &str) -> PathBuf {
+ // Try to extract filename from URL or use default
+ let filename = match url.split('/').next_back() {
+ Some(name) => name.to_string(),
+ None => format!("{executable}.AppImage"),
+ };
+
+ appimages_dir().join(filename)
+ }
pub async fn download_with_progress(
&self,
url: &str,