my ass forgot to delete older files
This commit is contained in:
parent
5239d2cd98
commit
32485708a1
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::{fs::create_dir_all, io::Write, path::Path};
|
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 directories::ProjectDirs;
|
||||||
use reqwest::blocking::Client;
|
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 let Some(file) = current_file {
|
||||||
if filename != file.file_name().into_string().unwrap().strip_prefix(format!("{}_", file_type).as_str()).unwrap() {
|
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)?;
|
update_file(client, file_path, file_type, file_url)?;
|
||||||
|
remove_file(file.path()).unwrap();
|
||||||
} else {
|
} else {
|
||||||
eprintln!("{} file already exists at: {}", file_type, file.path().display());
|
eprintln!("{} file already exists at: {}", file_type, file.path().display());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue