mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +00:00
Merge remote-tracking branch
'origin/GP-5015_d-millar_spaces_fix--SQUASHED' into patch (Closes #6999)
This commit is contained in:
commit
968a57a7ce
@ -132,31 +132,25 @@ public class ShellUtils {
|
||||
if (args.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder line = new StringBuilder(args.get(0));
|
||||
StringBuilder line = new StringBuilder(genreateArgument(args.get(0)));
|
||||
for (int i = 1; i < args.size(); i++) {
|
||||
String a = args.get(i);
|
||||
line.append(" " + genreateArgument(a));
|
||||
}
|
||||
return line.toString();
|
||||
}
|
||||
|
||||
public static String genreateArgument(String a) {
|
||||
if (a.contains(" ")) {
|
||||
if (a.contains("\"")) {
|
||||
if (a.contains("'")) {
|
||||
line.append(" \"");
|
||||
line.append(a.replace("\"", "\\\""));
|
||||
line.append("\"");
|
||||
continue;
|
||||
return "\"" + a.replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
line.append(" '");
|
||||
line.append(a);
|
||||
line.append("'");
|
||||
continue;
|
||||
return "'" + a + "'";
|
||||
}
|
||||
line.append(" \"");
|
||||
line.append(a);
|
||||
line.append("\"");
|
||||
continue;
|
||||
return "\"" + a + "\"";
|
||||
}
|
||||
line.append(" ");
|
||||
line.append(a);
|
||||
}
|
||||
return line.toString();
|
||||
return a;
|
||||
}
|
||||
|
||||
public static String generateEnvBlock(Map<String, String> env) {
|
||||
|
Loading…
Reference in New Issue
Block a user