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