mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2026-01-30 19:15:17 +01:00
* chore: Major refactoring Still needs a massive go-over because there shouldn't be anything referencing tauri in any of the workspaces except the original one. Process manager has been refactored as an example Signed-off-by: quexeky <git@quexeky.dev> * fix: Remote tauri dependency from process Signed-off-by: quexeky <git@quexeky.dev> * refactor: Improvements to src-tauri Signed-off-by: quexeky <git@quexeky.dev> * refactor: Builds, but some logic still left to move back Signed-off-by: quexeky <git@quexeky.dev> * refactor: Finish refactor Signed-off-by: quexeky <git@quexeky.dev> * chore: Run cargo clippy && cargo fmt Signed-off-by: quexeky <git@quexeky.dev> * refactor: Move everything into src-tauri Signed-off-by: quexeky <git@quexeky.dev> --------- Signed-off-by: quexeky <git@quexeky.dev>
40 lines
1.5 KiB
Rust
40 lines
1.5 KiB
Rust
use std::{fmt::Display, io::Error};
|
|
|
|
use serde_with::SerializeDisplay;
|
|
|
|
#[derive(SerializeDisplay)]
|
|
pub enum ProcessError {
|
|
NotInstalled,
|
|
AlreadyRunning,
|
|
InvalidID,
|
|
InvalidVersion,
|
|
IOError(Error),
|
|
FormatError(String), // String errors supremacy
|
|
InvalidPlatform,
|
|
OpenerError(tauri_plugin_opener::Error),
|
|
InvalidArguments(String),
|
|
FailedLaunch(String),
|
|
}
|
|
|
|
impl Display for ProcessError {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
let s = match self {
|
|
ProcessError::NotInstalled => "Game not installed",
|
|
ProcessError::AlreadyRunning => "Game already running",
|
|
ProcessError::InvalidID => "Invalid game ID",
|
|
ProcessError::InvalidVersion => "Invalid game version",
|
|
ProcessError::IOError(error) => &error.to_string(),
|
|
ProcessError::InvalidPlatform => "This game cannot be played on the current platform",
|
|
ProcessError::FormatError(error) => &format!("Could not format template: {error:?}"),
|
|
ProcessError::OpenerError(error) => &format!("Could not open directory: {error:?}"),
|
|
ProcessError::InvalidArguments(arguments) => {
|
|
&format!("Invalid arguments in command {arguments}")
|
|
}
|
|
ProcessError::FailedLaunch(game_id) => {
|
|
&format!("Drop detected that the game {game_id} may have failed to launch properly")
|
|
}
|
|
};
|
|
write!(f, "{s}")
|
|
}
|
|
}
|