Merge branch 'dev'

This commit is contained in:
2021-03-01 22:57:22 -06:00
15 changed files with 165 additions and 10 deletions

View File

@@ -20,7 +20,7 @@ impl Archive {
///
/// # Examples
/// ```
/// # use crate::client::archive::Archive;
/// # use client::archive::Archive;
/// let archive_res = Archive::try_default();
/// ```
pub fn try_default() -> Result<Self, ProjectDirError> {
@@ -45,7 +45,7 @@ impl Archive {
///
/// # Examples
/// ```
/// # use crate::client::archive::Archive;
/// # use client::archive::Archive;
/// let archive = Archive::new("/home/user/.local/share/save-sync", "/home/user/.config/save-sync");
/// ```
pub fn new<P: AsRef<Path>>(data_root: P, config_root: P) -> Self {
@@ -64,7 +64,7 @@ impl Archive {
}
}
/// Adds a path and it's contents to the list of tracked game files
/// Adds a path and its contents to the list of tracked game files
///
/// TODO: Add note here about how GameSaveLocation, GameFile and tracking individual files rather than directories work
///
@@ -73,12 +73,21 @@ impl Archive {
///
/// # Examples
/// ```
<<<<<<< HEAD
/// # use crate::client::archive::Archive;
/// 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)
=======
/// # use client::archive::Archive;
/// let mut archive = Archive::try_default().unwrap();
/// let save_path = "/home/user/Documents/generic_company/generic_game/save_folder";
/// match archive.track_game(save_path) {
/// Ok(_) => println!("Save Sync is now tracking {}", save_path),
/// Err(err) => eprintln!("Failed to track {}: {:?}", save_path, err)
>>>>>>> dev
/// };
/// ```
pub fn track_game<P: AsRef<Path>>(&mut self, path: P) -> Result<(), GameTrackError> {
@@ -87,6 +96,23 @@ impl Archive {
Ok(())
}
/// Adds a path and its contents to the list of tracked game files
///
/// TODO: Add similar note to the one in [`track_game`]
///
/// # Arguments
/// * `path` - The path which will be tracked along with any children it may have
///
/// # Examples
/// ```
/// # use client::archive::Archive;
/// let mut archive = Archive::try_default().unwrap();
/// let save_path = "/home/user/Documents/generic_company/generic_game/save_folder";
/// let friendly_name = "Generic Game";
/// match archive.track_game_with_friendly(save_path, friendly_name) {
/// Ok(_) => println!("Save Sync is now tracking {}", friendly_name),
/// Err(err) => eprintln!("Save Sync failed to start tracking {}", friendly_name)
/// };
pub fn track_game_with_friendly<P>(&mut self, path: P, name: &str) -> Result<(), GameTrackError>
where
P: AsRef<Path>,
@@ -149,7 +175,7 @@ impl Archive {
///
/// # Examples
/// ```
/// # use crate::client::archive::Archive;
/// # use client::archive::Archive;
/// let mut archive = Archive::try_default().unwrap();
/// let drop_res = archive.drop_game("/home/user/Documents/generic_company/generic_game/save_folder");
/// ```
@@ -170,7 +196,7 @@ impl Archive {
///
/// # Examples
/// ```
/// # use crate::client::archive::Archive;
/// # use client::archive::Archive;
/// let mut archive = Archive::try_default().unwrap();
/// let drop_res = archive.drop_game("raging_loop");
/// ```