@@ -505,8 +505,11 @@ func findIncludeForOldCompilers(source string) string {
505
505
func LibrariesLoader (
506
506
useCachedLibrariesResolution bool ,
507
507
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 ,
510
513
) (* librariesmanager.LibrariesManager , * librariesresolver.Cpp , []byte , error ) {
511
514
verboseOut := & bytes.Buffer {}
512
515
lm := librariesManager
@@ -518,21 +521,20 @@ func LibrariesLoader(
518
521
if librariesManager == nil {
519
522
lmb := librariesmanager .NewBuilder ()
520
523
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 {
524
526
return nil , nil , nil , err
525
527
}
526
528
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
527
- Path : builtInLibrariesFolders ,
529
+ Path : builtInLibrariesDir ,
528
530
Location : libraries .IDEBuiltIn ,
529
531
})
530
532
}
531
533
532
- if actualPlatform != targetPlatform {
534
+ if buildPlatform != targetPlatform {
533
535
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
534
- PlatformRelease : actualPlatform ,
535
- Path : actualPlatform .GetLibrariesDir (),
536
+ PlatformRelease : buildPlatform ,
537
+ Path : buildPlatform .GetLibrariesDir (),
536
538
Location : libraries .ReferencedPlatformBuiltIn ,
537
539
})
538
540
}
@@ -542,7 +544,7 @@ func LibrariesLoader(
542
544
Location : libraries .PlatformBuiltIn ,
543
545
})
544
546
545
- librariesFolders := otherLibrariesDirs
547
+ librariesFolders := librariesDirs
546
548
if err := librariesFolders .ToAbs (); err != nil {
547
549
return nil , nil , nil , err
548
550
}
@@ -553,7 +555,7 @@ func LibrariesLoader(
553
555
})
554
556
}
555
557
556
- for _ , dir := range libraryDirs {
558
+ for _ , dir := range customLibraryDirs {
557
559
lmb .AddLibrariesDir (librariesmanager.LibrariesDir {
558
560
Path : dir ,
559
561
Location : libraries .Unmanaged ,
@@ -563,18 +565,12 @@ func LibrariesLoader(
563
565
564
566
newLm , libsLoadingWarnings := lmb .Build ()
565
567
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.
572
568
verboseOut .Write ([]byte (status .Message ()))
573
569
}
574
570
lm = newLm
575
571
}
576
572
577
573
allLibs := lm .FindAllInstalled ()
578
- resolver := librariesresolver .NewCppResolver (allLibs , targetPlatform , actualPlatform )
574
+ resolver := librariesresolver .NewCppResolver (allLibs , targetPlatform , buildPlatform )
579
575
return lm , resolver , verboseOut .Bytes (), nil
580
576
}
0 commit comments