Skip to content

Commit 38f6fba

Browse files
runner: Add method to get mutable RunnerInfo
1 parent df47920 commit 38f6fba

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/runner/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ pub trait Runner {
108108
/// Get the common runner information
109109
fn info(&self) -> &RunnerInfo;
110110

111+
/// Get the common runner information
112+
fn info_mut(&mut self) -> &mut RunnerInfo;
113+
111114
/// Check if the runner executable is available and functional
112115
fn is_available(&self) -> bool {
113116
let executable_path = self.info().executable_path();

src/runner/proton.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ impl TryFrom<&Path> for Proton {
1717
let executable = PathBuf::from("./proton");
1818
let info = RunnerInfo::try_from(path, &executable)?;
1919
let mut wine = Wine::try_from(path.join("files").as_path())?;
20+
wine.info_mut().name = info.name.clone();
2021
Ok(Proton { wine, info })
2122
}
2223
}
@@ -29,4 +30,8 @@ impl Runner for Proton {
2930
fn info(&self) -> &RunnerInfo {
3031
&self.info
3132
}
33+
34+
fn info_mut(&mut self) -> &mut RunnerInfo {
35+
&mut self.info
36+
}
3237
}

src/runner/umu.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ impl Runner for UMU {
3434
fn info(&self) -> &RunnerInfo {
3535
&self.info
3636
}
37+
38+
fn info_mut(&mut self) -> &mut RunnerInfo {
39+
&mut self.info
40+
}
3741
}

src/runner/wine.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ impl Runner for Wine {
3535
fn info(&self) -> &RunnerInfo {
3636
&self.info
3737
}
38+
39+
fn info_mut(&mut self) -> &mut RunnerInfo {
40+
&mut self.info
41+
}
3842
}

0 commit comments

Comments
 (0)