@@ -505,8 +505,11 @@ func findIncludeForOldCompilers(source string) string {
505505func LibrariesLoader (
506506 useCachedLibrariesResolution bool ,
507507 librariesManager * librariesmanager.LibrariesManager ,
508- builtInLibrariesDirs * paths.Path , libraryDirs , otherLibrariesDirs paths.PathList ,
509- actualPlatform , targetPlatform * cores.PlatformRelease ,
508+ builtInLibrariesDir * paths.Path ,
509+ customLibraryDirs paths.PathList , // libraryDirs paths.PathList,
510+ librariesDirs paths.PathList , // otherLibrariesDirs paths.PathList,
511+ buildPlatform * cores.PlatformRelease ,
512+ targetPlatform * cores.PlatformRelease ,
510513) (* librariesmanager.LibrariesManager , * librariesresolver.Cpp , []byte , error ) {
511514 verboseOut := & bytes.Buffer {}
512515 lm := librariesManager
@@ -518,21 +521,20 @@ func LibrariesLoader(
518521 if librariesManager == nil {
519522 lmb := librariesmanager .NewBuilder ()
520523
521- builtInLibrariesFolders := builtInLibrariesDirs
522- if builtInLibrariesFolders != nil {
523- if err := builtInLibrariesFolders .ToAbs (); err != nil {
524+ if builtInLibrariesDir != nil {
525+ if err := builtInLibrariesDir .ToAbs (); err != nil {
524526 return nil , nil , nil , err
525527 }
526528 lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
527- Path : builtInLibrariesFolders ,
529+ Path : builtInLibrariesDir ,
528530 Location : libraries .IDEBuiltIn ,
529531 })
530532 }
531533
532- if actualPlatform != targetPlatform {
534+ if buildPlatform != targetPlatform {
533535 lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
534- PlatformRelease : actualPlatform ,
535- Path : actualPlatform .GetLibrariesDir (),
536+ PlatformRelease : buildPlatform ,
537+ Path : buildPlatform .GetLibrariesDir (),
536538 Location : libraries .ReferencedPlatformBuiltIn ,
537539 })
538540 }
@@ -542,7 +544,7 @@ func LibrariesLoader(
542544 Location : libraries .PlatformBuiltIn ,
543545 })
544546
545- librariesFolders := otherLibrariesDirs
547+ librariesFolders := librariesDirs
546548 if err := librariesFolders .ToAbs (); err != nil {
547549 return nil , nil , nil , err
548550 }
@@ -553,7 +555,7 @@ func LibrariesLoader(
553555 })
554556 }
555557
556- for _ , dir := range libraryDirs {
558+ for _ , dir := range customLibraryDirs {
557559 lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
558560 Path : dir ,
559561 Location : libraries .Unmanaged ,
@@ -563,18 +565,12 @@ func LibrariesLoader(
563565
564566 newLm , libsLoadingWarnings := lmb .Build ()
565567 for _ , status := range libsLoadingWarnings {
566- // With the refactoring of the initialization step of the CLI we changed how
567- // errors are returned when loading platforms and libraries, that meant returning a list of
568- // errors instead of a single one to enhance the experience for the user.
569- // I have no intention right now to start a refactoring of the legacy package too, so
570- // here's this shitty solution for now.
571- // When we're gonna refactor the legacy package this will be gone.
572568 verboseOut .Write ([]byte (status .Message ()))
573569 }
574570 lm = newLm
575571 }
576572
577573 allLibs := lm .FindAllInstalled ()
578- resolver := librariesresolver .NewCppResolver (allLibs , targetPlatform , actualPlatform )
574+ resolver := librariesresolver .NewCppResolver (allLibs , targetPlatform , buildPlatform )
579575 return lm , resolver , verboseOut .Bytes (), nil
580576}
0 commit comments