@@ -297,16 +297,27 @@ def check_config():
297
297
else :
298
298
cli_config = json .loads (output )
299
299
if cli_config is not None :
300
- if cli_config ["directories" ]["data" ] is not None :
301
- sketches_path_list .append (Path (cli_config ["directories" ]["data" ]))
302
- else :
303
- print ("No data directory" )
304
- quit (1 )
305
- if cli_config ["directories" ]["user" ] is not None :
306
- sketches_path_list .append (Path (cli_config ["directories" ]["user" ]))
300
+ # Since arduino-cli 1.x new level "config"
301
+ if "config" in cli_config .keys ():
302
+ cli_config = cli_config ["config" ]
303
+ # Since arduino-cli 1.x config init does not create full config
304
+ if "directories" in cli_config .keys ():
305
+ if "data" in cli_config ["directories" ].key ():
306
+ if cli_config ["directories" ]["data" ] is not None :
307
+ sketches_path_list .append (
308
+ Path (cli_config ["directories" ]["data" ])
309
+ )
310
+ else :
311
+ print ("No data directory" )
312
+ if "user" in cli_config ["directories" ].key ():
313
+ if cli_config ["directories" ]["user" ] is not None :
314
+ sketches_path_list .append (
315
+ Path (cli_config ["directories" ]["user" ])
316
+ )
317
+ else :
318
+ print ("No user directory!" )
307
319
else :
308
- print ("No user directory!" )
309
- quit (1 )
320
+ print ("No directories in config!" )
310
321
# Fill search_path_list to avoid search on the same path
311
322
sorted_spl = sorted (set (sketches_path_list ))
312
323
search_path_list = []
@@ -526,7 +537,11 @@ def find_board():
526
537
print (e .stdout .decode ("utf-8" ))
527
538
quit (e .returncode )
528
539
else :
529
- fqbn_list_tmp = [board ["fqbn" ] for board in json .loads (output )]
540
+ boards = json .loads (output )
541
+ # Since arduino-cli 1.x new level "boards" and is a dict
542
+ if type (boards ) is dict :
543
+ boards = boards ["boards" ]
544
+ fqbn_list_tmp = [board ["fqbn" ] for board in boards ]
530
545
if not len (fqbn_list_tmp ):
531
546
print (f"No boards found for { arduino_platform } " )
532
547
quit (1 )
0 commit comments