[core] Parsers: strict VDF, Steam, Epic, GOG, manual and Domi sources, WinPath, GameId, Launch URIs, merge

This commit is contained in:
2026-11-22 23:26:18 +01:00
parent e85f160f88
commit cf5ba34bed
32 changed files with 1275 additions and 100 deletions
+21 -3
View File
@@ -6,7 +6,10 @@
//! web games (Rosea, Moin) opened by URL.
use crate::error::ParseError;
use crate::model::Game;
use crate::id::{GameId, Source};
use crate::launch::Launch;
use crate::model::{CoverHint, Game};
use crate::text;
/// How a Domi game starts.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -20,6 +23,21 @@ pub enum DomiLaunch<'a> {
/// The game for one Domi entry. `id` follows the Atrium id rules (`[a-z0-9-]{1,32}`, no `-` at either end) and
/// becomes `domi:<id>`; `name` is the title. No install folder.
pub fn game(id: &str, name: &str, launch: DomiLaunch<'_>) -> Result<Game, ParseError> {
let _ = (id, name, launch);
Err(ParseError::BadId)
if !text::is_atrium_id(id) {
return Err(ParseError::BadId);
}
let title = text::title(name, "name")?;
let launch = match launch {
DomiLaunch::Link { app } => Launch::domi_link(app)?,
DomiLaunch::Web { url, allowed_hosts } => Launch::web(url, allowed_hosts)?,
};
let id = GameId::new(Source::Domi, id)?;
Ok(Game {
cover: Some(CoverHint::lettered(&title, &id)),
id,
source: Source::Domi,
title,
install_dir: None,
launch,
})
}