mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-13 08:12:44 +10:00
* feat: add new template options, asahi support, and refactoring * feat: install dir scanning, validation fixes, progress fixes, download manager refactor This kind of ballooned out of scope, but I implemented some much needed fixes for the download manager. First off, I cleanup the Downloadable trait, there was some duplication of function. Second, I refactored the "validate" into the GameDownloadAgent, which calls a 'validate_chunk_logic' yada, same structure as downloading. Third, I fixed the progress and validation issues. Fourth, I added game scanning * feat: out of box support for Asahi Linux * fix: clippy * fix: don't break database
34 lines
1.0 KiB
Rust
34 lines
1.0 KiB
Rust
use std::collections::HashMap;
|
|
|
|
use dynfmt::{Argument, FormatArgs};
|
|
|
|
pub struct DropFormatArgs {
|
|
positional: Vec<String>,
|
|
map: HashMap<&'static str, String>,
|
|
}
|
|
|
|
impl DropFormatArgs {
|
|
pub fn new(launch_string: String, working_dir: &String, executable_name: &String, absolute_executable_name: String) -> Self {
|
|
let mut positional = Vec::new();
|
|
let mut map: HashMap<&'static str, String> = HashMap::new();
|
|
|
|
positional.push(launch_string);
|
|
|
|
map.insert("dir", working_dir.to_string());
|
|
map.insert("exe", executable_name.to_string());
|
|
map.insert("abs_exe", absolute_executable_name);
|
|
|
|
Self { positional, map }
|
|
}
|
|
}
|
|
|
|
impl FormatArgs for DropFormatArgs {
|
|
fn get_index(&self, index: usize) -> Result<Option<dynfmt::Argument<'_>>, ()> {
|
|
Ok(self.positional.get(index).map(|arg| arg as Argument<'_>))
|
|
}
|
|
|
|
fn get_key(&self, key: &str) -> Result<Option<dynfmt::Argument<'_>>, ()> {
|
|
Ok(self.map.get(key).map(|arg| arg as Argument<'_>))
|
|
}
|
|
}
|