44
44
public class WorkAround {
45
45
// Each time this class is touched consider changing the String below to enforce
46
46
// updates
47
- private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created TXT file V3.00.test 25 " ;
47
+ private static final String FIRST_SLOEBER_WORKAROUND_LINE = "#Sloeber created TXT file V3.00.test 34 " ;
48
48
49
49
private static Map <String , String > USB_replacers ;
50
50
51
51
static
52
52
{
53
53
USB_replacers = new TreeMap <>();
54
+
55
+ if (isWindows ) {
54
56
55
57
USB_replacers .put (" '-DUSB_MANUFACTURER={build.usb_manufacturer}' " ,
56
58
" \" -DUSB_MANUFACTURER={build.usb_manufacturer}\" " );
@@ -66,6 +68,21 @@ public class WorkAround {
66
68
67
69
USB_replacers .put (" '-DUSB_SERIAL=\" {build.usb_serial}\" ' " , " \" -DUSB_SERIAL=\\ \" {build.usb_serial}\\ \" \" " );
68
70
USB_replacers .put (" '-DUSB_SERIAL={build.usb_serial}' " , " \" -DUSB_SERIAL={build.usb_serial}\" " );
71
+ }else {
72
+ USB_replacers .put (" -DUSB_MANUFACTURER=\" {build.usb_manufacturer}\" " ,
73
+ " '-DUSB_MANUFACTURER=\" {build.usb_manufacturer}\" ' " );
74
+ USB_replacers .put (" -DUSB_PRODUCT=\" {build.usb_product}\" " ," '-DUSB_PRODUCT=\" {build.usb_product}\" ' " );
75
+ USB_replacers .put (" -DARDUINO_BOARD=\" {build.board}\" " , " '-DARDUINO_BOARD=\" {build.board}\" ' " );
76
+ USB_replacers .put (" -DUSB_SERIAL=\" {build.usb_serial}\" " , " '-DUSB_SERIAL=\" {build.usb_serial}\" ' " );
77
+
78
+ //esp32 has
79
+ //extraflags=-DARDUINO_HOST_OS=
80
+ //so no space in search
81
+ USB_replacers .put ("-DARDUINO_HOST_OS=\" {runtime.os}\" " , "'-DARDUINO_HOST_OS=\" {runtime.os}\" ' " );
82
+ USB_replacers .put (" -DARDUINO_VARIANT=\" {build.variant}\" " , " '-DARDUINO_VARIANT=\" {build.variant}\" ' " );
83
+ USB_replacers .put (" -DARDUINO_FQBN=\" {build.fqbn}\" " , " '-DARDUINO_FQBN=\" {build.fqbn}\" ' " );
84
+
85
+ }
69
86
70
87
}
71
88
@@ -158,10 +175,12 @@ public static String boardsApplyWorkArounds(String inBoardsTXT) {
158
175
boardsTXT = boardsTXT .replace ("\n " , " \n " );
159
176
boardsTXT = solveOSStuff (boardsTXT );
160
177
161
- // replace FI circuitplay32u4cat.build.usb_manufacturer="Adafruit"
162
- // with circuitplay32u4cat.build.usb_manufacturer=\"Adafruit\"
163
- boardsTXT = boardsTXT .replaceAll ("(\\ S+\\ .build\\ .usb\\ S+)=\\ \" (.+)\\ \" " ,
164
- "$1=\\ \\ \" $2\\ \\ \" " );
178
+ if (isWindows ) {
179
+ // replace FI circuitplay32u4cat.build.usb_manufacturer="Adafruit"
180
+ // with circuitplay32u4cat.build.usb_manufacturer=\"Adafruit\"
181
+ boardsTXT = boardsTXT .replaceAll ("(\\ S+\\ .build\\ .usb\\ S+)=\\ \" (.+)\\ \" " ,
182
+ "$1=\\ \\ \" $2\\ \\ \" " );
183
+ }
165
184
166
185
// quoting fixes for embedutils
167
186
// ['\"]?(-DMBEDTLS_\S+)=\\?"(mbedtls\S+?)\\?\"["']? \"$1=\\\"$2\\\"\"
@@ -241,6 +260,7 @@ public static String platformApplyWorkArounds(String inPlatformTxt, File request
241
260
platformTXT = platformTXT .replaceAll ("(?m)^(\\ S*)\\ s*=" , "$1=" );
242
261
// remove -MMD (the dependency generation parameter
243
262
platformTXT = platformTXT .replaceAll (" -MMD " , " " );
263
+ // add a space at the end of the line
244
264
platformTXT = platformTXT .replace ("\n " , " \n " );
245
265
246
266
platformTXT = solveOSStuff (platformTXT );
0 commit comments