Skip to content

Commit

Permalink
Use system umu-launcher to run games
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanse committed Apr 28, 2024
1 parent e825172 commit aaee53e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 38 deletions.
3 changes: 2 additions & 1 deletion src/config/config2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ impl Config {
.with_prompt("Select game")
.items(&self.games.clone())
.interact_opt()
.unwrap()?;
.unwrap()
.unwrap();

Ok(self.games[sel].clone())
}
Expand Down
25 changes: 0 additions & 25 deletions src/config/extra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,4 @@ impl ExtraConfig {
#[cfg(test)]
mod tests {
use std::fs;

#[test]
fn test_proton_finder() {
let parent = "/tmp/parent";
fs::create_dir(parent).unwrap();
let prots: Vec<&str> = vec!["Proton-30", "Proton-32"];
let mut want: Vec<String> = vec![];

for prot in prots {
let dir = format!("{}/{}", parent, prot);
fs::create_dir(dir.clone()).unwrap();
fs::File::create(format!("{}/proton", dir.clone())).unwrap();
want.push(dir);
}

let mut runners: Vec<String> = vec![];

super::ExtraConfig::get_runners_for(parent.to_string(), &mut runners).unwrap();

fs::remove_dir_all(parent).unwrap();

println!("{:?}", runners);
want.reverse();
assert_eq!(want, runners);
}
}
15 changes: 3 additions & 12 deletions src/config/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ impl Game {
let mut cmd = Command::new("sh");

if !self.is_native {
#[cfg(feature = "nixos")]
cmd.arg("steam-run");

cmd.arg(format!("{}/ulwgl-run", get_ulwgl_path()));
cmd.arg(format!("umu"));
}

cmd.arg(self.exect_path.clone());
Expand Down Expand Up @@ -169,10 +166,7 @@ mod tests {
use super::Game;

fn get_ulwgl_exec_path() -> String {
format!(
"{}/.local/share/ULWGL/ulwgl-run",
std::env::var("HOME").unwrap()
)
format!("umu")
}

fn get_game() -> Game {
Expand Down Expand Up @@ -219,10 +213,7 @@ mod tests {
let args: Vec<&OsStr> = cmd.get_args().collect();

#[cfg(feature = "nixos")]
assert_eq!(
args,
&["steam-run", &get_ulwgl_exec_path(), "/home/me/exec"]
);
assert_eq!(args, &[&get_ulwgl_exec_path(), "/home/me/exec"]);

#[cfg(not(feature = "nixos"))]
assert_eq!(args, &[&get_ulwgl_exec_path(), "/home/me/exec"]);
Expand Down

0 comments on commit aaee53e

Please sign in to comment.