proton_launch/command/
runnable.rs

1use thiserror::Error;
2
3use crate::{paths::Paths, proton::ProtonVersion, steam::SteamData};
4
5#[derive(Debug, Error)]
6pub enum RunnableError {
7    #[error("No proton found, you can install one with `proton-launch install <version>`")]
8    NoProtonAtAll,
9    #[error("{} is not installed, you can install it with `proton-launch install {}`", .0, .0.arg_name())]
10    SelectedProtonNotInstalled(ProtonVersion),
11
12    #[error("Failed to spawn process: {}", .0)]
13    SpawnError(std::io::Error),
14
15    #[error("Generic IO error: {}", .0)]
16    IOError(#[from] std::io::Error),
17
18    #[error("No executable specified")]
19    NoExe,
20}
21
22pub type RunnableResult<O> = Result<O, RunnableError>;
23
24pub trait Runnable {
25    fn run(&self, paths: &Paths, steam_data: &SteamData) -> RunnableResult<()>;
26}