@@ -489,8 +489,11 @@ func findIncludeForOldCompilers(source string) string {
489
489
func LibrariesLoader (
490
490
useCachedLibrariesResolution bool ,
491
491
librariesManager * librariesmanager.LibrariesManager ,
492
- builtInLibrariesDirs * paths.Path , libraryDirs , otherLibrariesDirs paths.PathList ,
493
- actualPlatform , targetPlatform * cores.PlatformRelease ,
492
+ builtInLibrariesDir * paths.Path ,
493
+ customLibraryDirs paths.PathList ,
494
+ librariesDirs paths.PathList ,
495
+ buildPlatform * cores.PlatformRelease ,
496
+ targetPlatform * cores.PlatformRelease ,
494
497
) (* librariesresolver.Cpp , []byte , error ) {
495
498
verboseOut := & bytes.Buffer {}
496
499
lm := librariesManager
@@ -502,21 +505,20 @@ func LibrariesLoader(
502
505
if librariesManager == nil {
503
506
lmb := librariesmanager .NewBuilder ()
504
507
505
- builtInLibrariesFolders := builtInLibrariesDirs
506
- if builtInLibrariesFolders != nil {
507
- if err := builtInLibrariesFolders .ToAbs (); err != nil {
508
+ if builtInLibrariesDir != nil {
509
+ if err := builtInLibrariesDir .ToAbs (); err != nil {
508
510
return nil , nil , err
509
511
}
510
512
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
511
- Path : builtInLibrariesFolders ,
513
+ Path : builtInLibrariesDir ,
512
514
Location : libraries .IDEBuiltIn ,
513
515
})
514
516
}
515
517
516
- if actualPlatform != targetPlatform {
518
+ if buildPlatform != targetPlatform {
517
519
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
518
- PlatformRelease : actualPlatform ,
519
- Path : actualPlatform .GetLibrariesDir (),
520
+ PlatformRelease : buildPlatform ,
521
+ Path : buildPlatform .GetLibrariesDir (),
520
522
Location : libraries .ReferencedPlatformBuiltIn ,
521
523
})
522
524
}
@@ -526,7 +528,7 @@ func LibrariesLoader(
526
528
Location : libraries .PlatformBuiltIn ,
527
529
})
528
530
529
- librariesFolders := otherLibrariesDirs
531
+ librariesFolders := librariesDirs
530
532
if err := librariesFolders .ToAbs (); err != nil {
531
533
return nil , nil , err
532
534
}
@@ -537,7 +539,7 @@ func LibrariesLoader(
537
539
})
538
540
}
539
541
540
- for _ , dir := range libraryDirs {
542
+ for _ , dir := range customLibraryDirs {
541
543
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
542
544
Path : dir ,
543
545
Location : libraries .Unmanaged ,
@@ -547,18 +549,12 @@ func LibrariesLoader(
547
549
548
550
newLm , libsLoadingWarnings := lmb .Build ()
549
551
for _ , status := range libsLoadingWarnings {
550
- // With the refactoring of the initialization step of the CLI we changed how
551
- // errors are returned when loading platforms and libraries, that meant returning a list of
552
- // errors instead of a single one to enhance the experience for the user.
553
- // I have no intention right now to start a refactoring of the legacy package too, so
554
- // here's this shitty solution for now.
555
- // When we're gonna refactor the legacy package this will be gone.
556
552
verboseOut .Write ([]byte (status .Message ()))
557
553
}
558
554
lm = newLm
559
555
}
560
556
561
557
allLibs := lm .FindAllInstalled ()
562
- resolver := librariesresolver .NewCppResolver (allLibs , targetPlatform , actualPlatform )
558
+ resolver := librariesresolver .NewCppResolver (allLibs , targetPlatform , buildPlatform )
563
559
return resolver , verboseOut .Bytes (), nil
564
560
}
0 commit comments