Skip to content

Commit

Permalink
Do not consider bundle/custom platforms while installing/upgrading cores
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Sep 14, 2018
1 parent 4f935b8 commit daee3c6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
13 changes: 12 additions & 1 deletion commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,21 @@ var AppName = filepath.Base(os.Args[0])

var Config *configs.Configuration

// InitPackageManagerWithoutBundles initializes the PackageManager
// but ignores bundles and user installed cores
func InitPackageManagerWithoutBundles() *packagemanager.PackageManager {
logrus.Info("Package manager will scan only managed hardware folder")

fakeResult := false
Config.IDEBundledCheckResult = &fakeResult
Config.SketchbookDir = nil
return InitPackageManager()
}

// InitPackageManager initializes the PackageManager
// TODO: for the daemon mode, this might be called at startup, but for now only commands needing the PM will call it
func InitPackageManager() *packagemanager.PackageManager {
logrus.Info("Loading the default Package index")
logrus.Info("Initializing package manager")

pm := packagemanager.NewPackageManager(
Config.IndexesDir(),
Expand Down
2 changes: 1 addition & 1 deletion commands/core/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func runDownloadCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino core download`")

platformsRefs := parsePlatformReferenceArgs(args)
pm := commands.InitPackageManager()
pm := commands.InitPackageManagerWithoutBundles()
for _, platformRef := range platformsRefs {
downloadPlatformByRef(pm, platformRef)
}
Expand Down
2 changes: 1 addition & 1 deletion commands/core/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino core download`")

platformsRefs := parsePlatformReferenceArgs(args)
pm := commands.InitPackageManager()
pm := commands.InitPackageManagerWithoutBundles()

for _, platformRef := range platformsRefs {
downloadPlatformByRef(pm, platformRef)
Expand Down
2 changes: 1 addition & 1 deletion commands/core/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func runUninstallCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino core download`")

platformsRefs := parsePlatformReferenceArgs(args)
pm := commands.InitPackageManager()
pm := commands.InitPackageManagerWithoutBundles()

for _, platformRef := range platformsRefs {
uninstallPlatformByRef(pm, platformRef)
Expand Down
2 changes: 1 addition & 1 deletion commands/core/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func initUpgradeCommand() *cobra.Command {
func runUpgradeCommand(cmd *cobra.Command, args []string) {
logrus.Info("Executing `arduino core upgrade`")

pm := commands.InitPackageManager()
pm := commands.InitPackageManagerWithoutBundles()

platformsRefs := parsePlatformReferenceArgs(args)
if len(platformsRefs) == 0 {
Expand Down
6 changes: 4 additions & 2 deletions configs/hardware_directories.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ func (config *Configuration) HardwareDirectories() (paths.PathList, error) {
res.Add(dir)
}

if dir := config.SketchbookDir.Join("hardware"); dir.IsDir() {
res.Add(dir)
if config.SketchbookDir != nil {
if dir := config.SketchbookDir.Join("hardware"); dir.IsDir() {
res.Add(dir)
}
}

return res, nil
Expand Down

0 comments on commit daee3c6

Please sign in to comment.