1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Mac OS support: work around for selecting executables inside packages. Add the mach-o binary parser by default, don't require a file extension for executables.

This commit is contained in:
Ken Ryall 2006-05-09 22:42:49 +00:00
parent debff1a147
commit 1db2529522
2 changed files with 16 additions and 1 deletions

View file

@ -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);
}
}

View file

@ -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;