@@ -27,9 +27,11 @@ type SourceFile struct {
2727 // Path to the source file within the sketch/library root folder
2828 relativePath * paths.Path
2929
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
3335
3436 // The source root for the given origin, where its source files
3537 // can be found. Prepending this to SourceFile.RelativePath will give
@@ -61,7 +63,7 @@ func MakeSourceFile(ctx *Context, origin interface{}, path *paths.Path) (*Source
6163 case * libraries.Library :
6264 res .buildRoot = ctx .LibrariesBuildPath .Join (o .DirName )
6365 res .sourceRoot = o .SourceDir
64- res .Library = o
66+ res .extraIncludePath = o . UtilityDir
6567 default :
6668 panic ("Unexpected origin for SourceFile: " + fmt .Sprint (origin ))
6769 }
@@ -77,6 +79,10 @@ func MakeSourceFile(ctx *Context, origin interface{}, path *paths.Path) (*Source
7779 return res , nil
7880}
7981
82+ func (f * SourceFile ) ExtraIncludePath () * paths.Path {
83+ return f .extraIncludePath
84+ }
85+
8086func (f * SourceFile ) SourcePath () * paths.Path {
8187 return f .sourceRoot .JoinPath (f .relativePath )
8288}
0 commit comments