Skip to content

Commit a74f08c

Browse files
committed
Correction for replacing text in variable.
Addes if statments tom make it look abit more readeble.
1 parent 9f87668 commit a74f08c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/tools/ArduinoHelpers.java

+12-5
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070
*/
7171
public class ArduinoHelpers extends Common {
7272

73+
private static final String BUILD_PATH_SYSCALLS_SAM3 = "\"{build.path}/syscalls_sam3.c.o\"";
74+
private static final String BUILD_PATH_ARDUINO_SYSCALLS_SAM3 = "\"{build.path}/arduino/syscalls_sam3.c.o\"";
75+
private static final String BUILD_PATH_SYSCALLS_MTK = "\"{build.path}/syscalls_sam3.c.o\"";
76+
private static final String BUILD_PATH_ARDUINO_SYSCALLS_MTK = "\"{build.path}/arduino/syscalls_sam3.c.o\"";
77+
7378
/**
7479
* This method is the internal working class that adds the provided includepath to all configurations and languages.
7580
*
@@ -642,11 +647,13 @@ private static void setTheEnvironmentVariablesAddthePlatformTxt(IContributedEnvi
642647
if (RealData.length > 0) {
643648
String Var[] = RealData[0].split("=", 2); // look for assignment
644649
if (Var.length == 2) {
645-
String Value = MakeEnvironmentString(Var[1].replace("\"{build.path}/syscalls_sam3.c.o\"",
646-
"\"{build.path}/arduino/syscalls_sam3.c.o\""));
647-
Value = MakeEnvironmentString(Var[1].replace("\"{build.path}/syscalls_mtk.c.o\"",
648-
"\"{build.path}/arduino/syscalls_mtk.c.o\""));
649-
var = new EnvironmentVariable(MakeKeyString(Var[0]), Value);
650+
String value = Var[1];
651+
if (value.contains(BUILD_PATH_SYSCALLS_SAM3)) {
652+
value = MakeEnvironmentString(value.replace(BUILD_PATH_SYSCALLS_SAM3, BUILD_PATH_ARDUINO_SYSCALLS_SAM3));
653+
} else if (value.contains(BUILD_PATH_SYSCALLS_MTK)) {
654+
value = MakeEnvironmentString(value.replace(BUILD_PATH_SYSCALLS_MTK, BUILD_PATH_ARDUINO_SYSCALLS_MTK));
655+
}
656+
var = new EnvironmentVariable(MakeKeyString(Var[0]), value);
650657
contribEnv.addVariable(var, confDesc);
651658
}
652659
}

0 commit comments

Comments
 (0)