Skip to content

Commit 88010e2

Browse files
committed
Moved code in a more logical grouping
1 parent 383757d commit 88010e2

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Diff for: internal/arduino/cores/packagemanager/loader.go

+3-5
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,19 @@ func (pm *Builder) loadPlatform(targetPackage *cores.Package, architecture strin
228228
}
229229

230230
func (pm *Builder) loadPlatformRelease(platform *cores.PlatformRelease, path *paths.Path) error {
231-
platform.InstallDir = path
232-
233231
// If the installed.json file is found load it, this is done to handle the
234232
// case in which the platform's index and its url have been deleted locally,
235233
// if we don't load it some information about the platform is lost
236234
installedJSONPath := path.Join("installed.json")
237-
platform.Timestamps.AddFile(installedJSONPath)
238235
if installedJSONPath.Exist() {
239236
if _, err := pm.LoadPackageIndexFromFile(installedJSONPath); err != nil {
240237
return errors.New(i18n.Tr("loading %[1]s: %[2]s", installedJSONPath, err))
241238
}
242239
}
243240

244-
// TODO: why CLONE?
245-
platform.Properties = platform.Properties.Clone()
241+
platform.InstallDir = path
242+
platform.Timestamps.AddFile(installedJSONPath)
243+
platform.Properties = platform.Properties.Clone() // TODO: why CLONE?
246244

247245
// Create platform properties
248246
platformTxtPath := path.Join("platform.txt")

Diff for: internal/arduino/cores/packagemanager/profiles.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ func (pmb *Builder) LoadHardwareForProfile(ctx context.Context, p *sketch.Profil
7272
}
7373

7474
func (pmb *Builder) loadProfilePlatform(ctx context.Context, platformRef *sketch.ProfilePlatformReference, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, settings *configuration.Settings) (*cores.PlatformRelease, error) {
75-
targetPackage := pmb.packages.GetOrCreatePackage(platformRef.Packager)
76-
platform := targetPackage.GetOrCreatePlatform(platformRef.Architecture)
77-
release := platform.GetOrCreateRelease(platformRef.Version)
78-
7975
uid := platformRef.InternalUniqueIdentifier()
8076
destDir := settings.ProfilesCacheDir().Join(uid)
8177
if !destDir.IsDir() && installMissing {
@@ -84,6 +80,10 @@ func (pmb *Builder) loadProfilePlatform(ctx context.Context, platformRef *sketch
8480
return nil, err
8581
}
8682
}
83+
84+
targetPackage := pmb.packages.GetOrCreatePackage(platformRef.Packager)
85+
platform := targetPackage.GetOrCreatePlatform(platformRef.Architecture)
86+
release := platform.GetOrCreateRelease(platformRef.Version)
8787
return release, pmb.loadPlatformRelease(release, destDir)
8888
}
8989

0 commit comments

Comments
 (0)