From e585f18abd0c5a613beeb9a84c575ce1f1cddbdc Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 4 Mar 2010 19:34:09 +0000 Subject: [PATCH] [263689] Special handling of -environment-cd for MacOS --- .../commands/macos/MacOSMIEnvironmentCD.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIEnvironmentCD.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIEnvironmentCD.java index 38f0ccd83e5..d5d5e73f2a6 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIEnvironmentCD.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/macos/MacOSMIEnvironmentCD.java @@ -16,7 +16,21 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIEnvironmentCD; public class MacOSMIEnvironmentCD extends MIEnvironmentCD { + // We need to send the following format: + // -environment-cd "\"/path/without/any/spaces\"" or -environment-cd /path/without/any/spaces + // -environment-cd "\"/path/with spaces\"" public MacOSMIEnvironmentCD(ICommandControlDMContext ctx, String path) { - super(ctx, '\"' + path + '\"'); + super(ctx, (path == null) ? null : "\"\\\"" + path + "\\\"\""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Override + protected String parametersToString() { + // Apple's GDB is very picky. We override the parameter formatting + // so that we can control exactly what will be sent to GDB. + StringBuffer buffer = new StringBuffer(); + for (String parameter : getParameters()) { + buffer.append(' ').append(parameter); + } + return buffer.toString().trim(); } }