Windows: Compiler wasn't supplying Windows command line with the correct double quotes

This commit is contained in:
Federico Fissore 2015-04-24 12:03:41 +02:00
parent d805fb4e1f
commit f54851ecfa
2 changed files with 8 additions and 8 deletions

View File

@ -54,7 +54,7 @@ import processing.app.preproc.PdePreprocessor;
import processing.app.legacy.PApplet;
import processing.app.packages.LegacyUserLibrary;
import processing.app.packages.UserLibrary;
import processing.app.tools.ArgumentsWithSpaceAwareCommandLine;
import processing.app.tools.DoubleQuotedArgumentsOnWindowsCommandLine;
public class Compiler implements MessageConsumer {
@ -723,7 +723,7 @@ public class Compiler implements MessageConsumer {
}
});
CommandLine commandLine = new ArgumentsWithSpaceAwareCommandLine(command[0]);
CommandLine commandLine = new DoubleQuotedArgumentsOnWindowsCommandLine(command[0]);
for (int i = 1; i < command.length; i++) {
commandLine.addArgument(command[i], false);
}

View File

@ -7,24 +7,24 @@ import processing.app.helpers.OSUtils;
import java.io.File;
public class ArgumentsWithSpaceAwareCommandLine extends CommandLine {
public class DoubleQuotedArgumentsOnWindowsCommandLine extends CommandLine {
public ArgumentsWithSpaceAwareCommandLine(String executable) {
public DoubleQuotedArgumentsOnWindowsCommandLine(String executable) {
super(executable);
}
public ArgumentsWithSpaceAwareCommandLine(File executable) {
public DoubleQuotedArgumentsOnWindowsCommandLine(File executable) {
super(executable);
}
public ArgumentsWithSpaceAwareCommandLine(CommandLine other) {
public DoubleQuotedArgumentsOnWindowsCommandLine(CommandLine other) {
super(other);
}
@Override
public CommandLine addArgument(String argument, boolean handleQuoting) {
if (argument.contains(" ") && OSUtils.isWindows()) {
argument = argument.replaceAll("\"", "").replaceAll("'", "");
if (argument.contains("\"") && OSUtils.isWindows()) {
argument = argument.replace("\"", "\\\"");
}
return super.addArgument(argument, handleQuoting);