fix: add original_path property to GameSaveLocation

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-03-01 21:27:22 -06:00
parent 71d4fb91d7
commit 5cf660666a
2 changed files with 7 additions and 2 deletions

View File

@ -132,7 +132,7 @@ impl Archive {
// FIXME: There most likely is a function that does this (check clippy)
let friendly_name = friendly_name.map(|s| s.to_owned());
Ok(GameSaveLocation::new(game_files, friendly_name))
Ok(GameSaveLocation::new(path, game_files, friendly_name))
}
/// Removes a game from the list of traked games

View File

@ -12,14 +12,19 @@ const XXHASH64_SEED: u64 = 1337;
#[derive(Debug, Clone)]
pub struct GameSaveLocation {
pub friendly_name: Option<String>,
pub original_path: PathBuf,
files: Vec<GameFile>,
uuid: Uuid,
}
impl GameSaveLocation {
pub fn new(files: Vec<GameFile>, friendly_name: Option<String>) -> Self {
pub fn new<P>(path: P, files: Vec<GameFile>, friendly_name: Option<String>) -> Self
where
P: AsRef<Path>,
{
Self {
friendly_name,
original_path: path.as_ref().to_path_buf(),
files,
uuid: Uuid::new_v4(),
}