@@ -27,9 +27,11 @@ type SourceFile struct {
27
27
// Path to the source file within the sketch/library root folder
28
28
relativePath * paths.Path
29
29
30
- // Set to the Library object of origin if this source file comes
31
- // from a library
32
- Library * libraries.Library
30
+ // ExtraIncludePath contains an extra include path that must be
31
+ // used to compile this source file.
32
+ // This is mainly used for source files that comes from old-style libraries
33
+ // (Arduino IDE <1.5) requiring an extra include path to the "utility" folder.
34
+ extraIncludePath * paths.Path
33
35
34
36
// The source root for the given origin, where its source files
35
37
// can be found. Prepending this to SourceFile.RelativePath will give
@@ -61,7 +63,7 @@ func MakeSourceFile(ctx *Context, origin interface{}, path *paths.Path) (*Source
61
63
case * libraries.Library :
62
64
res .buildRoot = ctx .LibrariesBuildPath .Join (o .DirName )
63
65
res .sourceRoot = o .SourceDir
64
- res .Library = o
66
+ res .extraIncludePath = o . UtilityDir
65
67
default :
66
68
panic ("Unexpected origin for SourceFile: " + fmt .Sprint (origin ))
67
69
}
@@ -77,6 +79,10 @@ func MakeSourceFile(ctx *Context, origin interface{}, path *paths.Path) (*Source
77
79
return res , nil
78
80
}
79
81
82
+ func (f * SourceFile ) ExtraIncludePath () * paths.Path {
83
+ return f .extraIncludePath
84
+ }
85
+
80
86
func (f * SourceFile ) SourcePath () * paths.Path {
81
87
return f .sourceRoot .JoinPath (f .relativePath )
82
88
}
0 commit comments