Skip to content

Commit 59b9710

Browse files
committed
Merged downloadPlatform with the proper packagamanger method
1 parent f7b0e61 commit 59b9710

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

commands/core/download.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import (
1919
"context"
2020

2121
"github.com/arduino/arduino-cli/arduino"
22-
"github.com/arduino/arduino-cli/arduino/cores"
2322
"github.com/arduino/arduino-cli/arduino/cores/packagemanager"
24-
"github.com/arduino/arduino-cli/arduino/httpclient"
2523
"github.com/arduino/arduino-cli/commands"
2624
"github.com/arduino/arduino-cli/i18n"
2725
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
@@ -51,7 +49,7 @@ func PlatformDownload(ctx context.Context, req *rpc.PlatformDownloadRequest, dow
5149
return nil, &arduino.PlatformNotFoundError{Platform: ref.String(), Cause: err}
5250
}
5351

54-
if err := downloadPlatform(pm, platform, downloadCB); err != nil {
52+
if err := pm.DownloadPlatformRelease(platform, nil, downloadCB); err != nil {
5553
return nil, err
5654
}
5755

@@ -63,12 +61,3 @@ func PlatformDownload(ctx context.Context, req *rpc.PlatformDownloadRequest, dow
6361

6462
return &rpc.PlatformDownloadResponse{}, nil
6563
}
66-
67-
func downloadPlatform(pm *packagemanager.PackageManager, platformRelease *cores.PlatformRelease, downloadCB rpc.DownloadProgressCB) error {
68-
// Download platform
69-
config, err := httpclient.GetDownloaderConfig()
70-
if err != nil {
71-
return &arduino.FailedDownloadError{Message: tr("Error downloading platform %s", platformRelease), Cause: err}
72-
}
73-
return pm.DownloadPlatformRelease(platformRelease, config, downloadCB)
74-
}

commands/core/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func installPlatform(pm *packagemanager.PackageManager,
9999
return err
100100
}
101101
}
102-
if err := downloadPlatform(pm, platformRelease, downloadCB); err != nil {
102+
if err := pm.DownloadPlatformRelease(platformRelease, nil, downloadCB); err != nil {
103103
return err
104104
}
105105
taskCB(&rpc.TaskProgress{Completed: true})

0 commit comments

Comments
 (0)