TODO: Backslash and quoting is not handled properly, needs to be done.
(input: &str)
| 308 | |
| 309 | // TODO: Backslash and quoting is not handled properly, needs to be done. |
| 310 | fn get_exec_command(input: &str) -> String { |
| 311 | let mut output = String::new(); |
| 312 | let mut chars = input.chars().peekable(); |
| 313 | |
| 314 | while let Some(c) = chars.next() { |
| 315 | match c { |
| 316 | '%' => { |
| 317 | if let Some('%') = chars.peek() { |
| 318 | // %% -> % |
| 319 | output.push('%'); |
| 320 | chars.next(); |
| 321 | } else { |
| 322 | // %X -> remove both |
| 323 | chars.next(); |
| 324 | } |
| 325 | } |
| 326 | '"' => { |
| 327 | // Remove double quotes entirely |
| 328 | } |
| 329 | _ => { |
| 330 | output.push(c); |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | // Removing file inputs from flatpak exec commands |
| 336 | if output.ends_with('@') { |
| 337 | output = output.chars().take(output.chars().count() - 7).collect(); |
| 338 | } |
| 339 | output.trim().to_owned() |
| 340 | } |
| 341 | |
| 342 | fn get_desktop_id(file_path: &Path) -> String { |
| 343 | let mut return_string_val = String::new(); |
no outgoing calls
no test coverage detected