@@ -53,6 +53,18 @@ func (s *LibrariesBuilder) Run(ctx *types.Context) error {
53
53
return nil
54
54
}
55
55
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
+
56
68
func findExpectedPrecompiledLibFolder (ctx * types.Context , library * libraries.Library ) * paths.Path {
57
69
mcu := ctx .BuildProperties .Get (constants .BUILD_PROPERTIES_BUILD_MCU )
58
70
// Add fpu specifications if they exist
@@ -86,15 +98,15 @@ func findExpectedPrecompiledLibFolder(ctx *types.Context, library *libraries.Lib
86
98
if len (fpuSpecs ) > 0 {
87
99
fpuSpecs = strings .TrimRight (fpuSpecs , "-" )
88
100
fullPrecompDir := library .SourceDir .Join (mcu ).Join (fpuSpecs )
89
- if fullPrecompDir .Exist () {
101
+ if fullPrecompDir .Exist () && containsFile ( fullPrecompDir ) {
90
102
logger .Fprintln (os .Stdout , constants .LOG_LEVEL_INFO , "Using precompiled library in {0}" , fullPrecompDir )
91
103
return fullPrecompDir
92
104
}
93
105
logger .Fprintln (os .Stdout , constants .LOG_LEVEL_INFO , "Precompiled library in \" {0}\" not found" , fullPrecompDir )
94
106
}
95
107
96
108
precompDir := library .SourceDir .Join (mcu )
97
- if precompDir .Exist () {
109
+ if precompDir .Exist () && containsFile ( precompDir ) {
98
110
logger .Fprintln (os .Stdout , constants .LOG_LEVEL_INFO , "Using precompiled library in {0}" , precompDir )
99
111
return precompDir
100
112
}
0 commit comments