mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-24 05:10:16 +00:00
Merge remote-tracking branch 'origin/GP-3553_Dan_fixQuickLaunchSpaces'
into patch (Closes #5460)
This commit is contained in:
commit
bbe24ed391
@ -15,7 +15,7 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.debug.service.model.launch;
|
||||
|
||||
import static ghidra.async.AsyncUtils.*;
|
||||
import static ghidra.async.AsyncUtils.loop;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@ -275,7 +275,8 @@ public abstract class AbstractDebuggerProgramLaunchOffer implements DebuggerProg
|
||||
for (Entry<String, ParameterDescription<?>> entry : params.entrySet()) {
|
||||
map.put(entry.getKey(), entry.getValue().defaultValue);
|
||||
}
|
||||
map.put(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, program.getExecutablePath());
|
||||
map.put(TargetCmdLineLauncher.CMDLINE_ARGS_NAME,
|
||||
TargetCmdLineLauncher.quoteImagePathIfSpaces(program.getExecutablePath()));
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,25 @@ public interface TargetLauncher extends TargetObject {
|
||||
*/
|
||||
TargetParameterMap PARAMETERS = TargetMethod.makeParameters(PARAMETER_CMDLINE_ARGS);
|
||||
|
||||
/**
|
||||
* Check if the given image path contains spaces, and surround it in double quotes
|
||||
* ({@code "}) if necessary.
|
||||
*
|
||||
* <p>
|
||||
* Without the quotes the launcher will likely confuse the spaces for separating arguments.
|
||||
* When constructing the command-line to launch a program, this method must be used, even if
|
||||
* the image is the only "argument."
|
||||
*
|
||||
* @param imagePath the path to the image on the target platform.
|
||||
* @return the path, possibly surrounded in quotes.
|
||||
*/
|
||||
static String quoteImagePathIfSpaces(String imagePath) {
|
||||
if (imagePath.contains(" ")) {
|
||||
return '"' + imagePath + '"';
|
||||
}
|
||||
return imagePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
default public TargetParameterMap getParameters() {
|
||||
return PARAMETERS;
|
||||
|
Loading…
Reference in New Issue
Block a user