MacOS: command path never gets checked #1709
Description
When I configure my settings to use custom Arduino CLI, it always shows that there is invalid Arduino path.
I have managed to trace the bug to the following code block in file src/extension.ts
at line 126:
if (!usingBundledArduinoCli && (!arduinoPath || !validateArduinoPath(arduinoPath, useArduinoCli))) {
Logger.traceError("InvalidArduinoPath", new Error(constants.messages.INVALID_ARDUINO_PATH));
await askSwitchToBundledCli(constants.messages.INVALID_ARDUINO_PATH + " " + constants.messages.SWITCH_TO_BUNDLED_CLI);
I have set the following setting in settings.json
:
"arduino.useArduinoCli": true,
"arduino.commandPath": "/some/valid/path/to/arduino-cli",
Therefore, this is the state at the above code block:
usingBundledArduinoCli
is false
arduinoPath
is equivalent to false
because I don't have the Arduino app installed, and useArduinoCli
is true
,
validateArduinoPath(arduinoPath, useArduinoCli)
will always return empty string a.k.a false
.
So, the if statement will always be true, despite the fact that Arduino IDE is not desired.
My suggestion to fixing the bug is to change the if statement to the following:
if (!usingBundledArduinoCli && !useArduinoCli && (!arduinoPath || !validateArduinoPath(arduinoPath, useArduinoCli)))
I will post this fix in a pull request soon.