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

@@ -137,9 +137,15 @@ impl RustDoomLauncher {
fn form_command_string(&self) -> String {
match self.get_launcher_and_command(false) {
Ok((launch, comms)) => {
//TODO - escape all the strings
let c = comms.join(" ");
format!("{} {}", launch, c)
let mut command_string = String::new();
// Feels like a bit of a hack, but it works I think
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::NoIwad) => "Error: No IWAD".to_string(),
@@ -364,7 +370,9 @@ impl eframe::App for RustDoomLauncher {
ui.horizontal(|ui| {
let mut text = self.form_command_string();
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),
);
});
}
});