MCPcopy Create free account
hub / github.com/VimYoung/Spell / get_exec_command

Function get_exec_command

spell-framework/src/vault/application.rs:310–340  ·  view source on GitHub ↗

TODO: Backslash and quoting is not handled properly, needs to be done.

(input: &str)

Source from the content-addressed store, hash-verified

308
309// TODO: Backslash and quoting is not handled properly, needs to be done.
310fn 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
342fn get_desktop_id(file_path: &Path) -> String {
343 let mut return_string_val = String::new();

Callers 1

desktop_entry_extracterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected