From c43d4fdf9c44a9fd6fc3b00a73fcd789987371a2 Mon Sep 17 00:00:00 2001 From: Kirill Date: Tue, 24 Feb 2026 10:56:48 +0300 Subject: [PATCH] feat(rclone.exe): Function new() This function first of all created app object by 1) Defining the application directory 2) Creating dirs if they are not exists 3) Defining ways for rclone by yours os 4) Define rclone or install it --- src/rcloneInstall.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/rcloneInstall.rs b/src/rcloneInstall.rs index e63bd42..7cacb94 100644 --- a/src/rcloneInstall.rs +++ b/src/rcloneInstall.rs @@ -1,6 +1,28 @@ +use std::fs; +use std::path::PathBuf; +use std::process::Command; + pub struct RcloneApp { rclone_path: PathBuf, } impl RcloneApp { + pub fn new() -> Result> { + let app_dir = dirs::data_dir() + .ok_or("Не удалось найти папку для данных")? + .join("rclone-ui"); + + fs::create_dir_all(&app_dir)?; + let rclone_path = if cfg!(windows) { + app_dir.join("rclone.exe") + } else { + app_dir.join("rclone") + }; + + if !rclone_path.exists() { + Self::extract_rclone(&rclone_path)?; + } + + Ok(Self { rclone_path }) + } }