Skip to content

Commit cd2811d

Browse files
committed
Reverted back to the old code for mac issue #34
This should be fixed properly one day but as I don't own a mac ...
1 parent a2d6d99 commit cd2811d

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

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

+20-11
Original file line numberDiff line numberDiff line change
@@ -353,17 +353,26 @@ public static void setProjectPathVariables(IProject project, IPath platformPath)
353353

354354
try {
355355
Path arduinoPath = new Path(pathMan.getURIValue(ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_ARDUINO).getRawPath());
356-
// Path ArduinoPath = new Path(ArduinoURI.toString());
357-
String prefix = "${" + ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_ARDUINO + "}/";
358-
String test = prefix + arduinoHardwareLibraryPath.makeRelativeTo(arduinoPath).toString();
359-
URI uriTest = URIUtil.toURI(test);
360-
pathMan.setURIValue(ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_HARDWARE_LIB, uriTest);
361-
test = prefix + platformPath.makeRelativeTo(arduinoPath).toString();
362-
uriTest = URIUtil.toURI(test);
363-
pathMan.setURIValue(ArduinoConst.PATH_VARIABLE_NAME_ARDUINO_PLATFORM, uriTest);
364-
test = prefix + PinPath.makeRelativeTo(arduinoPath).toString();
365-
uriTest = URIUtil.toURI(test);
366-
pathMan.setURIValue(ArduinoConst.PATH_VARIABLE_NAME_ARDUINO_PINS, uriTest);
356+
// TODO the code below was changed for issue #34 (better multiple user support) but fails on Mac
357+
// So i split it to use the old code on mac.
358+
// but they should be merged
359+
if (Platform.getOS().equals(Platform.OS_MACOSX)) {
360+
pathMan.setURIValue(ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_HARDWARE_LIB, URIUtil.toURI(arduinoHardwareLibraryPath));
361+
pathMan.setURIValue(ArduinoConst.PATH_VARIABLE_NAME_ARDUINO_PLATFORM, URIUtil.toURI(platformPath));
362+
pathMan.setURIValue(ArduinoConst.PATH_VARIABLE_NAME_ARDUINO_PINS, URIUtil.toURI(PinPath));
363+
} else {
364+
365+
String prefix = "${" + ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_ARDUINO + "}/";
366+
String test = prefix + arduinoHardwareLibraryPath.makeRelativeTo(arduinoPath).toString();
367+
URI uriTest = URIUtil.toURI(test);
368+
pathMan.setURIValue(ArduinoConst.WORKSPACE_PATH_VARIABLE_NAME_HARDWARE_LIB, uriTest);
369+
test = prefix + platformPath.makeRelativeTo(arduinoPath).toString();
370+
uriTest = URIUtil.toURI(test);
371+
pathMan.setURIValue(ArduinoConst.PATH_VARIABLE_NAME_ARDUINO_PLATFORM, uriTest);
372+
test = prefix + PinPath.makeRelativeTo(arduinoPath).toString();
373+
uriTest = URIUtil.toURI(test);
374+
pathMan.setURIValue(ArduinoConst.PATH_VARIABLE_NAME_ARDUINO_PINS, uriTest);
375+
}
367376
} catch (CoreException e) {
368377
Common.log(new Status(IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID,
369378
"Failed to create the path variable variables. The setup will not work properly", e));

0 commit comments

Comments
 (0)