Bit of a hack to get shell escape working

This commit is contained in:
2023-06-07 22:43:15 +01:00
parent 5e0ed2feb8
commit e21151b5d0
2 changed files with 12 additions and 5 deletions

View File

@@ -12,5 +12,4 @@ native-dialog = "0.6.3"
rfd = "0.11.4" rfd = "0.11.4"
serde = "1.0.163" serde = "1.0.163"
serde_derive = "1.0.163" serde_derive = "1.0.163"
shell-escape = "0.1.5"
toml = "0.7.4" toml = "0.7.4"

View File

@@ -137,9 +137,15 @@ impl RustDoomLauncher {
fn form_command_string(&self) -> String { fn form_command_string(&self) -> String {
match self.get_launcher_and_command(false) { match self.get_launcher_and_command(false) {
Ok((launch, comms)) => { Ok((launch, comms)) => {
//TODO - escape all the strings let mut command_string = String::new();
let c = comms.join(" "); // Feels like a bit of a hack, but it works I think
format!("{} {}", launch, c) command_string.push_str(&Cow::from(launch).to_string());
for c in comms {
command_string.push_str(" \'");
command_string.push_str(c);
command_string.push('\'')
}
command_string
} }
Err(MyErrors::NoLauncher) => "Error: No launcher".to_string(), Err(MyErrors::NoLauncher) => "Error: No launcher".to_string(),
Err(MyErrors::NoIwad) => "Error: No IWAD".to_string(), Err(MyErrors::NoIwad) => "Error: No IWAD".to_string(),
@@ -364,7 +370,9 @@ impl eframe::App for RustDoomLauncher {
ui.horizontal(|ui| { ui.horizontal(|ui| {
let mut text = self.form_command_string(); let mut text = self.form_command_string();
let window_size = frame.info().window_info.size; let window_size = frame.info().window_info.size;
ui.add(egui::TextEdit::multiline(&mut text).desired_width(window_size[0] * 0.9)); ui.add(
egui::TextEdit::multiline(&mut text).desired_width(window_size[0] * 0.9),
);
}); });
} }
}); });