mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-14 22:56:42 +10:00
8ff7604502
* 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>
39 lines
1.0 KiB
Rust
39 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<'_>))
|
|
}
|
|
}
|