@@ -36,7 +36,6 @@ import (
36
36
"github.com/arduino/arduino-cli/internal/arduino/resources"
37
37
"github.com/arduino/arduino-cli/internal/arduino/sketch"
38
38
"github.com/arduino/arduino-cli/internal/arduino/utils"
39
- "github.com/arduino/arduino-cli/internal/cli/configuration"
40
39
"github.com/arduino/arduino-cli/internal/i18n"
41
40
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
42
41
paths "github.com/arduino/go-paths-helper"
@@ -72,7 +71,7 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
72
71
}
73
72
74
73
// Setup downloads directory
75
- downloadsDir := configuration . DownloadsDir ( s .settings )
74
+ downloadsDir := s .settings . DownloadsDir ( )
76
75
if downloadsDir .NotExist () {
77
76
err := downloadsDir .MkdirAll ()
78
77
if err != nil {
@@ -81,8 +80,9 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
81
80
}
82
81
83
82
// 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 ()
86
86
if packagesDir .NotExist () {
87
87
err := packagesDir .MkdirAll ()
88
88
if err != nil {
@@ -94,7 +94,7 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
94
94
if err != nil {
95
95
return nil , err
96
96
}
97
- inst , err := instances .Create (dataDir , packagesDir , downloadsDir , userAgent , config )
97
+ inst , err := instances .Create (dataDir , packagesDir , userPackagesDir , downloadsDir , userAgent , config )
98
98
if err != nil {
99
99
return nil , err
100
100
}
@@ -177,7 +177,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
177
177
defaultIndexURL , _ := utils .URLParse (globals .DefaultIndexURL )
178
178
allPackageIndexUrls := []* url.URL {defaultIndexURL }
179
179
if profile == nil {
180
- for _ , u := range s .settings .GetStringSlice ( "board_manager.additional_urls" ) {
180
+ for _ , u := range s .settings .BoardManagerAdditionalUrls ( ) {
181
181
URL , err := utils .URLParse (u )
182
182
if err != nil {
183
183
e := & cmderrors.InitFailedError {
@@ -192,7 +192,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
192
192
}
193
193
}
194
194
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 {
196
196
e := & cmderrors.InitFailedError {
197
197
Code : codes .InvalidArgument ,
198
198
Cause : err ,
@@ -245,7 +245,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
245
245
246
246
// Load Platforms
247
247
if profile == nil {
248
- for _ , err := range pmb .LoadHardware (s . settings ) {
248
+ for _ , err := range pmb .LoadHardware () {
249
249
s := & cmderrors.PlatformLoadingError {Cause : err }
250
250
responseError (s .GRPCStatus ())
251
251
}
@@ -349,7 +349,7 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
349
349
350
350
if profile == nil {
351
351
// Add directories of libraries bundled with IDE
352
- if bundledLibsDir := configuration . IDEBuiltinLibrariesDir ( s .settings ); bundledLibsDir != nil {
352
+ if bundledLibsDir := s .settings . IDEBuiltinLibrariesDir ( ); bundledLibsDir != nil {
353
353
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
354
354
Path : bundledLibsDir ,
355
355
Location : libraries .IDEBuiltIn ,
@@ -358,14 +358,14 @@ func (s *arduinoCoreServerImpl) Init(req *rpc.InitRequest, stream rpc.ArduinoCor
358
358
359
359
// Add libraries directory from config file
360
360
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
361
- Path : configuration . LibrariesDir ( s .settings ),
361
+ Path : s .settings . LibrariesDir ( ),
362
362
Location : libraries .User ,
363
363
})
364
364
} else {
365
365
// Load libraries required for profile
366
366
for _ , libraryRef := range profile .Libraries {
367
367
uid := libraryRef .InternalUniqueIdentifier ()
368
- libRoot := configuration . ProfilesCacheDir ( s .settings ).Join (uid )
368
+ libRoot := s .settings . ProfilesCacheDir ( ).Join (uid )
369
369
libDir := libRoot .Join (libraryRef .Library )
370
370
371
371
if ! libDir .IsDir () {
@@ -548,7 +548,7 @@ func (s *arduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream
548
548
Message : & rpc.UpdateIndexResponse_DownloadProgress {DownloadProgress : p },
549
549
})
550
550
}
551
- indexpath := configuration . DataDir ( s .settings )
551
+ indexpath := s .settings . DataDir ( )
552
552
553
553
urls := []string {globals .DefaultIndexURL }
554
554
if ! req .GetIgnoreCustomPackageIndexes () {
@@ -614,6 +614,7 @@ func (s *arduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream
614
614
downloadCB .Start (u , tr ("Downloading index: %s" , filepath .Base (URL .Path )))
615
615
downloadCB .End (false , tr ("Invalid network configuration: %s" , err ))
616
616
failed = true
617
+ continue
617
618
}
618
619
619
620
if strings .HasSuffix (URL .Host , "arduino.cc" ) && strings .HasSuffix (URL .Path , ".json" ) {
0 commit comments