diff --git a/client/src/archive.rs b/client/src/archive.rs index 722673a..13d480d 100644 --- a/client/src/archive.rs +++ b/client/src/archive.rs @@ -74,8 +74,12 @@ impl Archive { /// # Examples /// ``` /// # use crate::client::archive::Archive; - /// let archive = Archive::try_default() - /// archive.track_game("/home/user/Documents/generic_company/generic_game/save_folder") + /// let mut archive = Archive::try_default().unwrap(); + /// let game_save_path = "/home/user/Documents/generic_company/generic_game/save_folder"; + /// match archive.track_game(game_save_path) { + /// Ok(_) => println!("Save Sync is now tracking {}", game_save_path), + /// Err(err) => eprintln!("Failed to track {}: {:?}", game_save_path, err) + /// }; /// ``` pub fn track_game>(&mut self, path: P) -> Result<(), GameTrackError> { let game_save_loc = self.get_game_save_files(path, None)?; @@ -150,7 +154,11 @@ impl Archive { /// let drop_res = archive.drop_game("/home/user/Documents/generic_company/generic_game/save_folder"); /// ``` pub fn drop_game>(&mut self, path: P) -> Result<(), GameDropError> { - unimplemented!() + self.tracked_games + .retain(|game| game.original_path != path.as_ref()); + + // TODO: Remove backup copy of game save location on disk + Ok(()) } /// Removes a game from the list of tracked games using the game's friendly name @@ -167,7 +175,13 @@ impl Archive { /// let drop_res = archive.drop_game("raging_loop"); /// ``` pub fn drop_game_with_friendly(&mut self, name: &str) -> Result<(), GameDropError> { - unimplemented!() + self.tracked_games.retain(|game| match &game.friendly_name { + Some(f_name) => f_name != name, + None => false, + }); + + // TODO: Remove backup copy of game save location on disk + Ok(()) } }