Skip to content

Commit f54851e

Browse files
author
Federico Fissore
committed
Windows: Compiler wasn't supplying Windows command line with the correct double quotes
1 parent d805fb4 commit f54851e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

arduino-core/src/processing/app/debug/Compiler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import processing.app.legacy.PApplet;
5555
import processing.app.packages.LegacyUserLibrary;
5656
import processing.app.packages.UserLibrary;
57-
import processing.app.tools.ArgumentsWithSpaceAwareCommandLine;
57+
import processing.app.tools.DoubleQuotedArgumentsOnWindowsCommandLine;
5858

5959
public class Compiler implements MessageConsumer {
6060

@@ -723,7 +723,7 @@ public void stop() {
723723
}
724724
});
725725

726-
CommandLine commandLine = new ArgumentsWithSpaceAwareCommandLine(command[0]);
726+
CommandLine commandLine = new DoubleQuotedArgumentsOnWindowsCommandLine(command[0]);
727727
for (int i = 1; i < command.length; i++) {
728728
commandLine.addArgument(command[i], false);
729729
}

arduino-core/src/processing/app/tools/ArgumentsWithSpaceAwareCommandLine.java renamed to arduino-core/src/processing/app/tools/DoubleQuotedArgumentsOnWindowsCommandLine.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@
77

88
import java.io.File;
99

10-
public class ArgumentsWithSpaceAwareCommandLine extends CommandLine {
10+
public class DoubleQuotedArgumentsOnWindowsCommandLine extends CommandLine {
1111

12-
public ArgumentsWithSpaceAwareCommandLine(String executable) {
12+
public DoubleQuotedArgumentsOnWindowsCommandLine(String executable) {
1313
super(executable);
1414
}
1515

16-
public ArgumentsWithSpaceAwareCommandLine(File executable) {
16+
public DoubleQuotedArgumentsOnWindowsCommandLine(File executable) {
1717
super(executable);
1818
}
1919

20-
public ArgumentsWithSpaceAwareCommandLine(CommandLine other) {
20+
public DoubleQuotedArgumentsOnWindowsCommandLine(CommandLine other) {
2121
super(other);
2222
}
2323

2424
@Override
2525
public CommandLine addArgument(String argument, boolean handleQuoting) {
26-
if (argument.contains(" ") && OSUtils.isWindows()) {
27-
argument = argument.replaceAll("\"", "").replaceAll("'", "");
26+
if (argument.contains("\"") && OSUtils.isWindows()) {
27+
argument = argument.replace("\"", "\\\"");
2828
}
2929

3030
return super.addArgument(argument, handleQuoting);

0 commit comments

Comments
 (0)