From 32485708a116970ab1936a2b37275de78a171383 Mon Sep 17 00:00:00 2001 From: RabbyDevs <67389402+RabbyDevs@users.noreply.github.com> Date: Sun, 4 May 2025 17:31:09 +0300 Subject: [PATCH] my ass forgot to delete older files --- src/components/installer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/installer.rs b/src/components/installer.rs index 2b79c2a..7a772b4 100644 --- a/src/components/installer.rs +++ b/src/components/installer.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; use std::{fs::create_dir_all, io::Write, path::Path}; -use std::fs::{DirEntry, OpenOptions}; +use std::fs::{remove_file, DirEntry, OpenOptions}; use directories::ProjectDirs; use reqwest::blocking::Client; @@ -169,6 +169,7 @@ fn update_file_if_needed(dir: &Path, client: &Client, file_url: &str, file_type: if let Some(file) = current_file { if filename != file.file_name().into_string().unwrap().strip_prefix(format!("{}_", file_type).as_str()).unwrap() { update_file(client, file_path, file_type, file_url)?; + remove_file(file.path()).unwrap(); } else { eprintln!("{} file already exists at: {}", file_type, file.path().display()); }