Skip to content

Commit 9776def

Browse files
committed
Added cores.InstallPlatformInDirectory(..) helper function
1 parent 632b84d commit 9776def

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arduino/cores/packagemanager/install_uninstall.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,22 @@ import (
2323
"github.com/arduino/arduino-cli/arduino/cores"
2424
"github.com/arduino/arduino-cli/arduino/cores/packageindex"
2525
"github.com/arduino/arduino-cli/executils"
26+
"github.com/arduino/go-paths-helper"
2627
"github.com/pkg/errors"
2728
)
2829

29-
// InstallPlatform installs a specific release of a platform.
30+
// InstallPlatform installs a specific release of a platform in the default data directory.
3031
func (pm *PackageManager) InstallPlatform(platformRelease *cores.PlatformRelease) error {
3132
destDir := pm.PackagesDir.Join(
3233
platformRelease.Platform.Package.Name,
3334
"hardware",
3435
platformRelease.Platform.Architecture,
3536
platformRelease.Version.String())
37+
return pm.InstallPlatformInDirectory(platformRelease, destDir)
38+
}
39+
40+
// InstallPlatformInDirectory installs a specific release of a platform in a specific directory.
41+
func (pm *PackageManager) InstallPlatformInDirectory(platformRelease *cores.PlatformRelease, destDir *paths.Path) error {
3642
if err := platformRelease.Resource.Install(pm.DownloadDir, pm.TempDir, destDir); err != nil {
3743
return errors.Errorf(tr("installing platform %[1]s: %[2]s"), platformRelease, err)
3844
}

0 commit comments

Comments
 (0)