Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.
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

Description

@lersi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions