Skip to content

Commit daee3c6

Browse files
committed
Do not consider bundle/custom platforms while installing/upgrading cores
1 parent 4f935b8 commit daee3c6

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed

commands/commands.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,21 @@ var AppName = filepath.Base(os.Args[0])
6767

6868
var Config *configs.Configuration
6969

70+
// InitPackageManagerWithoutBundles initializes the PackageManager
71+
// but ignores bundles and user installed cores
72+
func InitPackageManagerWithoutBundles() *packagemanager.PackageManager {
73+
logrus.Info("Package manager will scan only managed hardware folder")
74+
75+
fakeResult := false
76+
Config.IDEBundledCheckResult = &fakeResult
77+
Config.SketchbookDir = nil
78+
return InitPackageManager()
79+
}
80+
7081
// InitPackageManager initializes the PackageManager
7182
// TODO: for the daemon mode, this might be called at startup, but for now only commands needing the PM will call it
7283
func InitPackageManager() *packagemanager.PackageManager {
73-
logrus.Info("Loading the default Package index")
84+
logrus.Info("Initializing package manager")
7485

7586
pm := packagemanager.NewPackageManager(
7687
Config.IndexesDir(),

commands/core/download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func runDownloadCommand(cmd *cobra.Command, args []string) {
4747
logrus.Info("Executing `arduino core download`")
4848

4949
platformsRefs := parsePlatformReferenceArgs(args)
50-
pm := commands.InitPackageManager()
50+
pm := commands.InitPackageManagerWithoutBundles()
5151
for _, platformRef := range platformsRefs {
5252
downloadPlatformByRef(pm, platformRef)
5353
}

commands/core/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
4747
logrus.Info("Executing `arduino core download`")
4848

4949
platformsRefs := parsePlatformReferenceArgs(args)
50-
pm := commands.InitPackageManager()
50+
pm := commands.InitPackageManagerWithoutBundles()
5151

5252
for _, platformRef := range platformsRefs {
5353
downloadPlatformByRef(pm, platformRef)

commands/core/uninstall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func runUninstallCommand(cmd *cobra.Command, args []string) {
4444
logrus.Info("Executing `arduino core download`")
4545

4646
platformsRefs := parsePlatformReferenceArgs(args)
47-
pm := commands.InitPackageManager()
47+
pm := commands.InitPackageManagerWithoutBundles()
4848

4949
for _, platformRef := range platformsRefs {
5050
uninstallPlatformByRef(pm, platformRef)

commands/core/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func initUpgradeCommand() *cobra.Command {
4646
func runUpgradeCommand(cmd *cobra.Command, args []string) {
4747
logrus.Info("Executing `arduino core upgrade`")
4848

49-
pm := commands.InitPackageManager()
49+
pm := commands.InitPackageManagerWithoutBundles()
5050

5151
platformsRefs := parsePlatformReferenceArgs(args)
5252
if len(platformsRefs) == 0 {

configs/hardware_directories.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ func (config *Configuration) HardwareDirectories() (paths.PathList, error) {
3636
res.Add(dir)
3737
}
3838

39-
if dir := config.SketchbookDir.Join("hardware"); dir.IsDir() {
40-
res.Add(dir)
39+
if config.SketchbookDir != nil {
40+
if dir := config.SketchbookDir.Join("hardware"); dir.IsDir() {
41+
res.Add(dir)
42+
}
4143
}
4244

4345
return res, nil

0 commit comments

Comments
 (0)