@@ -53,6 +53,18 @@ func (s *LibrariesBuilder) Run(ctx *types.Context) error {
5353 return nil
5454}
5555
56+ func containsFile (folder * paths.Path ) bool {
57+ res , _ := folder .ReadDir ()
58+ hasfiles := false
59+ for _ , el := range res {
60+ if ! el .IsDir () {
61+ hasfiles = true
62+ break
63+ }
64+ }
65+ return hasfiles
66+ }
67+
5668func findExpectedPrecompiledLibFolder (ctx * types.Context , library * libraries.Library ) * paths.Path {
5769 mcu := ctx .BuildProperties .Get (constants .BUILD_PROPERTIES_BUILD_MCU )
5870 // Add fpu specifications if they exist
@@ -86,15 +98,15 @@ func findExpectedPrecompiledLibFolder(ctx *types.Context, library *libraries.Lib
8698 if len (fpuSpecs ) > 0 {
8799 fpuSpecs = strings .TrimRight (fpuSpecs , "-" )
88100 fullPrecompDir := library .SourceDir .Join (mcu ).Join (fpuSpecs )
89- if fullPrecompDir .Exist () {
101+ if fullPrecompDir .Exist () && containsFile ( fullPrecompDir ) {
90102 logger .Fprintln (os .Stdout , constants .LOG_LEVEL_INFO , "Using precompiled library in {0}" , fullPrecompDir )
91103 return fullPrecompDir
92104 }
93105 logger .Fprintln (os .Stdout , constants .LOG_LEVEL_INFO , "Precompiled library in \" {0}\" not found" , fullPrecompDir )
94106 }
95107
96108 precompDir := library .SourceDir .Join (mcu )
97- if precompDir .Exist () {
109+ if precompDir .Exist () && containsFile ( precompDir ) {
98110 logger .Fprintln (os .Stdout , constants .LOG_LEVEL_INFO , "Using precompiled library in {0}" , precompDir )
99111 return precompDir
100112 }
0 commit comments