fixed instances now point to games

This commit is contained in:
2026-03-06 18:13:39 +01:00
parent 3da2a4a252
commit 6c5b212d1c
5 changed files with 16 additions and 32 deletions

View File

@@ -10,24 +10,19 @@ use crate::{types::link::Link, utils::walk_all_files};
/// Available game
#[derive(Debug, Clone, Deserialize)]
pub struct Game {
install_location: PathBuf,
path: PathBuf,
}
impl Game {
pub fn export_links(&self) -> Result<Vec<Link>, io::Error> {
let links: Vec<Link> = walk_all_files(&self.install_location)?
.map(|entry| {
Link::new(
entry.path(),
entry.path().strip_prefix(&self.install_location).unwrap(),
)
})
let links: Vec<Link> = walk_all_files(&self.path)?
.map(|entry| Link::new(entry.path(), entry.path().strip_prefix(&self.path).unwrap()))
.collect();
Ok(links)
}
pub fn install_location(&self) -> &Path {
&self.install_location
&self.path
}
}