Commit daee3c68 authored by Cristian Maglie's avatar Cristian Maglie

Do not consider bundle/custom platforms while installing/upgrading cores

parent 4f935b80
......@@ -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(),
......
......@@ -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)
}
......
......@@ -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)
......
......@@ -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)
......
......@@ -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 {
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment