Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-03-15 03:52:23 -0400
committerHenrik Rentz-Reichert2012-03-15 03:52:23 -0400
commit9ecaaf4085466277678b1db01375b11cd98d0bf5 (patch)
tree9611cf5150231fa11940f3a403878cdf8bb59036 /plugins/org.eclipse.etrice.generator.launch
parent7509f37a1981cd88e695d0da31fbf9bf5d147e18 (diff)
downloadorg.eclipse.etrice-9ecaaf4085466277678b1db01375b11cd98d0bf5.tar.gz
org.eclipse.etrice-9ecaaf4085466277678b1db01375b11cd98d0bf5.tar.xz
org.eclipse.etrice-9ecaaf4085466277678b1db01375b11cd98d0bf5.zip
[generator.launch] bug 373193: Space in path of workspace leads to error during generation of runner java files
https://bugs.eclipse.org/bugs/show_bug.cgi?id=373193
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.launch')
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
index 45c7ecdf9..3f92814a1 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
@@ -85,7 +85,29 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
pgmArgs = VariablesPlugin.getDefault().getStringVariableManager()
.performStringSubstitution(pgmArgs);
- String[] args = pgmArgs.split("[ \t]");
+ // split at single spaces but keep strings in double quotes as single argument
+ // (with double quotes removed)
+ ArrayList<String> res = new ArrayList<String>();
+ int begin = 0;
+ int end = pgmArgs.indexOf(' ');
+ boolean inQuotes = false;
+ while (end>0) {
+ if (pgmArgs.charAt(begin)=='\"')
+ inQuotes = true;
+ if ((inQuotes && pgmArgs.charAt(end-1)=='\"')) {
+ inQuotes = false;
+ }
+
+ if (!inQuotes) {
+ res.add(pgmArgs.substring(begin, end).replace("\"", ""));
+ begin = end+1;
+ }
+ end = pgmArgs.indexOf(' ', end+1);
+ }
+ res.add(pgmArgs.substring(begin).replace("\"", ""));
+
+ String[] args = new String[res.size()];
+ res.toArray(args);
final MessageConsole myConsole = findConsole(getConsoleName());
Display.getDefault().syncExec(new Runnable() {
@@ -152,7 +174,7 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
@SuppressWarnings("unchecked")
ArrayList<String> models = (ArrayList<String>) configuration.getAttribute("ModelFiles", Collections.EMPTY_LIST);
for (String model : models){
- argString.append(" "+model);
+ argString.append(" \""+model+"\"");
}
}

Back to the top