add support for Game.delete
This commit is contained in:
parent
2261a9a655
commit
caaf73e9f3
19
src/main.rs
19
src/main.rs
@ -358,6 +358,25 @@ async fn update(game: &Game<'_>, dir: &Path, bonus_content: bool, force: bool) {
|
|||||||
|
|
||||||
pb.finish();
|
pb.finish();
|
||||||
|
|
||||||
|
for f in game.delete.iter() {
|
||||||
|
let file_path = dir.join(f);
|
||||||
|
if file_path.exists() {
|
||||||
|
if let Err(_) = fs::remove_file(&file_path) {
|
||||||
|
println!(
|
||||||
|
"[{}] Couldn't delete {}",
|
||||||
|
"Error".bright_red(),
|
||||||
|
misc::cute_path(&file_path)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
println!(
|
||||||
|
"[{}] {}",
|
||||||
|
"Removed".bright_red(),
|
||||||
|
misc::cute_path(&file_path)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut hash_file_content = String::new();
|
let mut hash_file_content = String::new();
|
||||||
for (file, hash) in hashes.iter() {
|
for (file, hash) in hashes.iter() {
|
||||||
hash_file_content.push_str(&format!("{} {}\n", hash, file));
|
hash_file_content.push_str(&format!("{} {}\n", hash, file));
|
||||||
|
@ -12,6 +12,7 @@ pub struct Game<'a> {
|
|||||||
pub references: Vec<&'a str>,
|
pub references: Vec<&'a str>,
|
||||||
pub app_id: u32,
|
pub app_id: u32,
|
||||||
pub bonus: Vec<&'a str>,
|
pub bonus: Vec<&'a str>,
|
||||||
|
pub delete: Vec<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize, serde::Serialize)]
|
#[derive(serde::Deserialize, serde::Serialize)]
|
||||||
|
Loading…
Reference in New Issue
Block a user