diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java index c923c8c6926..98f6c7f87a5 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutablePageOne.java @@ -18,6 +18,7 @@ import java.util.Iterator; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.CheckStateChangedEvent; @@ -313,6 +314,14 @@ public class ImportExecutablePageOne extends WizardPage { wizard.setupFileDialog(dialog); String res = dialog.open(); if (res != null) { + if (Platform.getOS().equals(Platform.OS_MACOSX) && res.endsWith(".app")) + { + // On Mac OS X the file dialog will let you select the + // package but not the executable inside. + Path macPath = new Path(res); + res = res + "/Contents/MacOS/" + macPath.lastSegment(); + res = res.substring(0, res.length() - 4); + } singleExecutablePathField.setText(res); } } diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutableWizard.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutableWizard.java index 27eedb55b41..62f99f32cd3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutableWizard.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/importexecutable/ImportExecutableWizard.java @@ -18,6 +18,7 @@ import org.eclipse.cdt.core.ICDescriptorOperation; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.swt.widgets.FileDialog; @@ -53,7 +54,10 @@ public class ImportExecutableWizard extends AbstractImportExecutableWizard { public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException { descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID); - descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, "org.eclipse.cdt.core.PE"); + if (Platform.getOS().equals(Platform.OS_MACOSX)) + descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, "org.eclipse.cdt.core.MachO"); + else + descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID, "org.eclipse.cdt.core.PE"); } }; CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(newProject.getProject(), op, null); @@ -65,6 +69,8 @@ public class ImportExecutableWizard extends AbstractImportExecutableWizard { public boolean isExecutableFile(File file) { String filename = file.getName().toLowerCase(); + if (Platform.getOS().equals(Platform.OS_MACOSX)) + return true; // File extension not needed on Mac OS. if (filename.endsWith(".exe") || filename.endsWith(".dll") || filename.endsWith(".elf")) return true;