@@ -36,7 +36,6 @@ import (
3636 "github.com/arduino/arduino-cli/internal/arduino/resources"
3737 "github.com/arduino/arduino-cli/internal/arduino/sketch"
3838 "github.com/arduino/arduino-cli/internal/arduino/utils"
39- "github.com/arduino/arduino-cli/internal/cli/configuration"
4039 "github.com/arduino/arduino-cli/internal/i18n"
4140 rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
4241 paths "github.com/arduino/go-paths-helper"
@@ -72,7 +71,7 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
7271 }
7372
7473 // Setup downloads directory
75- downloadsDir := configuration . DownloadsDir ( s .settings )
74+ downloadsDir := s .settings . DownloadsDir ( )
7675 if downloadsDir .NotExist () {
7776 err := downloadsDir .MkdirAll ()
7877 if err != nil {
@@ -81,8 +80,9 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
8180 }
8281
8382 // Setup data directory
84- dataDir := configuration .DataDir (s .settings )
85- packagesDir := configuration .PackagesDir (s .settings )
83+ dataDir := s .settings .DataDir ()
84+ userPackagesDir := s .settings .UserDir ().Join ("hardware" )
85+ packagesDir := s .settings .PackagesDir ()
8686 if packagesDir .NotExist () {
8787 err := packagesDir .MkdirAll ()
8888 if err != nil {
@@ -94,7 +94,7 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
9494 if err != nil {
9595 return nil , err
9696 }
97- inst , err := instances .Create (dataDir , packagesDir , downloadsDir , userAgent , config )
97+ inst , err := instances .Create (dataDir , packagesDir , userPackagesDir , downloadsDir , userAgent , config )
9898 if err != nil {
9999 return nil , err
100100 }
@@ -177,7 +177,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
177177 defaultIndexURL , _ := utils .URLParse (globals .DefaultIndexURL )
178178 allPackageIndexUrls := []* url.URL {defaultIndexURL }
179179 if profile == nil {
180- for _ , u := range s .settings .GetStringSlice ( "board_manager.additional_urls" ) {
180+ for _ , u := range s .settings .BoardManagerAdditionalUrls ( ) {
181181 URL , err := utils .URLParse (u )
182182 if err != nil {
183183 e := & cmderrors.InitFailedError {
@@ -192,7 +192,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
192192 }
193193 }
194194
195- if err := firstUpdate (ctx , s , req .GetInstance (), configuration . DataDir ( s .settings ), downloadCallback , allPackageIndexUrls ); err != nil {
195+ if err := firstUpdate (ctx , s , req .GetInstance (), s .settings . DataDir ( ), downloadCallback , allPackageIndexUrls ); err != nil {
196196 e := & cmderrors.InitFailedError {
197197 Code : codes .InvalidArgument ,
198198 Cause : err ,
@@ -245,7 +245,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
245245
246246 // Load Platforms
247247 if profile == nil {
248- for _ , err := range pmb .LoadHardware (s . settings ) {
248+ for _ , err := range pmb .LoadHardware () {
249249 s := & cmderrors.PlatformLoadingError {Cause : err }
250250 responseError (s .GRPCStatus ())
251251 }
@@ -349,7 +349,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
349349
350350 if profile == nil {
351351 // Add directories of libraries bundled with IDE
352- if bundledLibsDir := configuration . IDEBuiltinLibrariesDir ( s .settings ); bundledLibsDir != nil {
352+ if bundledLibsDir := s .settings . IDEBuiltinLibrariesDir ( ); bundledLibsDir != nil {
353353 lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
354354 Path : bundledLibsDir ,
355355 Location : libraries .IDEBuiltIn ,
@@ -358,14 +358,14 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
358358
359359 // Add libraries directory from config file
360360 lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
361- Path : configuration . LibrariesDir ( s .settings ),
361+ Path : s .settings . LibrariesDir ( ),
362362 Location : libraries .User ,
363363 })
364364 } else {
365365 // Load libraries required for profile
366366 for _ , libraryRef := range profile .Libraries {
367367 uid := libraryRef .InternalUniqueIdentifier ()
368- libRoot := configuration . ProfilesCacheDir ( s .settings ).Join (uid )
368+ libRoot := s .settings . ProfilesCacheDir ( ).Join (uid )
369369 libDir := libRoot .Join (libraryRef .Library )
370370
371371 if ! libDir .IsDir () {
@@ -548,7 +548,7 @@ func (s *arduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream
548548 Message : & rpc.UpdateIndexResponse_DownloadProgress {DownloadProgress : p },
549549 })
550550 }
551- indexpath := configuration . DataDir ( s .settings )
551+ indexpath := s .settings . DataDir ( )
552552
553553 urls := []string {globals .DefaultIndexURL }
554554 if ! req .GetIgnoreCustomPackageIndexes () {
@@ -614,6 +614,7 @@ func (s *arduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream
614614 downloadCB .Start (u , tr ("Downloading index: %s" , filepath .Base (URL .Path )))
615615 downloadCB .End (false , tr ("Invalid network configuration: %s" , err ))
616616 failed = true
617+ continue
617618 }
618619
619620 if strings .HasSuffix (URL .Host , "arduino.cc" ) && strings .HasSuffix (URL .Path , ".json" ) {
0 commit comments