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

Fix commandPath issues #1443

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/arduino/arduinoSettings.ts
Original file line number Diff line number Diff line change
@@ -134,6 +134,9 @@ export class ArduinoSettings implements IArduinoSettings {
}

public get commandPath(): string {
if(!this._commandPath) {
return this._commandPath;
}
const platform = os.platform();
if (platform === "darwin") {
return path.join(util.resolveMacArduinoAppPath(this._arduinoPath, this._useArduinoCli), path.normalize(this._commandPath));
7 changes: 6 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@ const nsatModule =
impor("./nsat") as typeof import ("./nsat");
import { BuildMode } from "./arduino/arduino";
import { SerialMonitor } from "./serialmonitor/serialMonitor";
import { platform } from "os";
import { execFileSync } from "child_process";
const usbDetectorModule = impor("./serialmonitor/usbDetector") as typeof import ("./serialmonitor/usbDetector");

export async function activate(context: vscode.ExtensionContext) {
@@ -95,9 +97,12 @@ export async function activate(context: vscode.ExtensionContext) {
if (!arduinoPath || !validateArduinoPath(arduinoPath, useArduinoCli)) {
Logger.notifyUserError("InvalidArduinoPath", new Error(constants.messages.INVALID_ARDUINO_PATH));
vscode.commands.executeCommand("workbench.action.openGlobalSettings");
} else if (!commandPath || !util.fileExistsSync(commandPath)) {
} else if (commandPath && !util.fileExistsSync(commandPath)) {
Logger.notifyUserError("InvalidCommandPath", new Error(constants.messages.INVALID_COMMAND_PATH + commandPath));
} else {
if(commandPath) {
execFileSync(commandPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we executing commandPath here? registerArduinoCommand() is called in many places, some of which don't directly interact with the Arduino IDE.

}
await commandExecution(command, commandBody, args, getUserData);
}
}));
18 changes: 18 additions & 0 deletions src/views/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.