@@ -21,6 +21,7 @@ import (
21
21
"fmt"
22
22
"io/ioutil"
23
23
"net/url"
24
+ "os"
24
25
"path"
25
26
26
27
"github.com/arduino/arduino-cli/arduino/builder"
@@ -202,16 +203,25 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexReq, downloadCB Downlo
202
203
indexpath := paths .New (configuration .Settings .GetString ("directories.Data" ))
203
204
json_paths := []string {}
204
205
json_paths = append (json_paths , configuration .Settings .GetStringSlice ("board_manager.additional_paths" )... )
206
+
205
207
for _ , x := range json_paths {
206
208
logrus .Info ("JSON_PATH: " , x )
207
- //path_to_json, err := paths.New(x).Abs()
208
- path_to_json := indexpath .Join (x )
209
209
210
- if _ , err := packageindex .LoadIndexNoSign (path_to_json , false ); err != nil {
210
+ path_to_json , _ := paths .New (x ).Abs ()
211
+
212
+ if _ , err := packageindex .LoadIndexNoSign (path_to_json ); err != nil {
211
213
return nil , fmt .Errorf ("invalid package index in %s: %s" , path_to_json , err )
214
+ } else {
215
+ fi , _ := os .Stat (x )
216
+ downloadCB (& rpc.DownloadProgress {
217
+ File : "Updating index: " + path_to_json .Base (),
218
+ TotalSize : fi .Size (),
219
+ })
220
+ downloadCB (& rpc.DownloadProgress {Completed : true })
212
221
}
213
222
214
223
}
224
+
215
225
urls := []string {globals .DefaultIndexURL }
216
226
urls = append (urls , configuration .Settings .GetStringSlice ("board_manager.additional_urls" )... )
217
227
for _ , u := range urls {
@@ -662,12 +672,12 @@ func createInstance(ctx context.Context, getLibOnly bool) (*createInstanceResult
662
672
}
663
673
}
664
674
665
- indexpath := paths .New (configuration .Settings .GetString ("directories.Data" ))
675
+ // indexpath := paths.New(configuration.Settings.GetString("directories.Data"))
666
676
json_paths := []string {}
667
677
json_paths = append (json_paths , configuration .Settings .GetStringSlice ("board_manager.additional_paths" )... )
668
678
for _ , x := range json_paths {
669
679
//path_to_json, err := paths.New(x).Abs()
670
- path_to_json := indexpath . Join ( x )
680
+ path_to_json , _ := paths . New ( x ). Abs ( )
671
681
672
682
_ , err := res .Pm .LoadPackageIndexFromFile (path_to_json )
673
683
if err != nil {
0 commit comments