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

Commit 705ca06

Browse files
authored
fix the output path not exist issue (microsoft#653)
1 parent a9a04c0 commit 705ca06

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/arduino/arduino.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,14 @@ export class ArduinoApp {
141141
}
142142
if (dc.output) {
143143
const outputPath = path.resolve(ArduinoWorkspace.rootPath, dc.output);
144+
const dirPath = path.dirname(outputPath);
145+
if (!util.directoryExistsSync(dirPath)) {
146+
Logger.notifyUserError("InvalidOutPutPath", new Error(constants.messages.INVALID_OUTPUT_PATH + outputPath));
147+
return;
148+
}
149+
144150
args.push("--pref", `build.path=${outputPath}`);
151+
arduinoChannel.info(`Please see the build logs in Output path: ${outputPath}`);
145152
} else {
146153
const msg = "Output path is not specified. Unable to reuse previously compiled files. Upload could be slow. See README.";
147154
arduinoChannel.warning(msg);
@@ -254,7 +261,14 @@ export class ArduinoApp {
254261
}
255262
if (output || dc.output) {
256263
const outputPath = path.resolve(ArduinoWorkspace.rootPath, output || dc.output);
264+
const dirPath = path.dirname(outputPath);
265+
if (!util.directoryExistsSync(dirPath)) {
266+
Logger.notifyUserError("InvalidOutPutPath", new Error(constants.messages.INVALID_OUTPUT_PATH + outputPath));
267+
return;
268+
}
269+
257270
args.push("--pref", `build.path=${outputPath}`);
271+
arduinoChannel.info(`Please see the build logs in Output path: ${outputPath}`);
258272
} else {
259273
const msg = "Output path is not specified. Unable to reuse previously compiled files. Verify could be slow. See README.";
260274
arduinoChannel.warning(msg);

src/common/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const messages = {
2929
SERIAL_PORT_NOT_STARTED: "Serial Monitor has not been started.",
3030
SEND_BEFORE_OPEN_SERIALPORT: "Please open a serial port first.",
3131
NO_PROGRAMMMER_SELECTED: "Please select the programmer first.",
32+
INVALID_OUTPUT_PATH: "Please check the \"output\" in the sketch Settings.Cannot find the output path:",
3233
};
3334

3435
export const statusBarPriority = {

0 commit comments

Comments
 (0)