Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

MacOS: command path never gets checked #1709

Open
lersi opened this issue Feb 1, 2024 · 2 comments
Open

MacOS: command path never gets checked #1709

lersi opened this issue Feb 1, 2024 · 2 comments

Comments

@lersi
Copy link

lersi commented Feb 1, 2024

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.

lersi added a commit to lersi/vscode-arduino that referenced this issue Feb 1, 2024
@lersi
Copy link
Author

lersi commented Feb 1, 2024

update: the suggested fix is in pull request #1710

@lersi
Copy link
Author

lersi commented Apr 26, 2024

the bug has been fixes at the community fork: https://github.com/vscode-arduino/vscode-arduino

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant