From 98800badf41d15b2ca0fc2860c3e7b21103c59e6 Mon Sep 17 00:00:00 2001 From: Sean Evoy Date: Fri, 4 Jun 2004 20:45:51 +0000 Subject: [PATCH] Fix for bug 60230 - Project with spaces in name produces 2 executables. Since Eclipse does not treat this as illegal and since I am using the project name as the default build goal name, this is a legit bug. The solution is to remove all spaces from the project name, so a new project called "Hello World" will produce a build goal called HelloWorld --- .../ui/wizards/NewManagedProjectWizard.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java index 5a6591f3068..bc2ed155d2f 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java +++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/wizards/NewManagedProjectWizard.java @@ -119,8 +119,7 @@ public class NewManagedProjectWizard extends NewCProjectWizard { } catch (CoreException e) { ManagedBuilderUIPlugin.log(e); } - String artifactName = newProject.getName(); - newTarget.setArtifactName(artifactName); + newTarget.setArtifactName(getBuildGoalName()); IConfiguration [] selectedConfigs = targetConfigurationPage.getSelectedConfigurations(); Random r = new Random(); r.setSeed(System.currentTimeMillis()); @@ -155,6 +154,19 @@ public class NewManagedProjectWizard extends NewCProjectWizard { monitor.done(); } + /** + * @return + */ + private String getBuildGoalName() { + String name = new String(); + // Check for spaces + String[] tokens = newProject.getName().split("\\s"); //$NON-NLS-1$ + for (int index = 0; index < tokens.length; ++index) { + name += tokens[index]; + } + return name; + } + /* (non-Javadoc) * @see org.eclipse.cdt.ui.wizards.NewCProjectWizard#doRunPrologue(org.eclipse.core.runtime.IProgressMonitor) */