Skip to content

Commit d1ae15a

Browse files
author
Akos Kitta
committed
Updated to the latest CLI config format.
See: arduino/arduino-cli@f2df284 Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent 7ca8830 commit d1ae15a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

arduino-ide-extension/src/node/arduino-cli.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,20 @@ export class ArduinoCli {
4747
async getDefaultConfig(): Promise<Config> {
4848
const execPath = await this.getExecPath();
4949
const result = await this.spawn(`"${execPath}"`, ['config', 'dump', '--format', 'json']);
50-
const { sketchbook_path, arduino_data } = JSON.parse(result);
51-
if (!sketchbook_path) {
52-
throw new Error(`Could not parse config. 'sketchbook_path' was missing from: ${result}`);
50+
const { directories } = JSON.parse(result);
51+
if (!directories) {
52+
throw new Error(`Could not parse config. 'directories' was missing from: ${result}`);
5353
}
54-
if (!arduino_data) {
55-
throw new Error(`Could not parse config. 'arduino_data' was missing from: ${result}`);
54+
const { sketchbook, data } = directories;
55+
if (!sketchbook) {
56+
throw new Error(`Could not parse config. 'sketchbook' was missing from: ${result}`);
57+
}
58+
if (!data) {
59+
throw new Error(`Could not parse config. 'data' was missing from: ${result}`);
5660
}
5761
return {
58-
sketchDirUri: FileUri.create(sketchbook_path).toString(),
59-
dataDirUri: FileUri.create(arduino_data).toString()
62+
sketchDirUri: FileUri.create(sketchbook).toString(),
63+
dataDirUri: FileUri.create(data).toString()
6064
};
6165
}
6266

0 commit comments

Comments
 (0)