Skip to content

Commit a37c5f1

Browse files
Use the correct library when a relative path is passed as --library value
1 parent 6ee0c24 commit a37c5f1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

commands/compile/compile.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
128128
// FIXME: This will be redundant when arduino-builder will be part of the cli
129129
builderCtx.OtherLibrariesDirs = paths.NewPathList(req.GetLibraries()...)
130130
builderCtx.OtherLibrariesDirs.Add(configuration.LibrariesDir(configuration.Settings))
131-
builderCtx.LibraryDirs = paths.NewPathList(req.Library...)
131+
for _, libPath := range paths.NewPathList(req.Library...) {
132+
if libPath, err = libPath.Abs(); err != nil {
133+
return nil, &arduino.LibraryNotFoundError{Cause: err}
134+
}
135+
builderCtx.LibraryDirs = append(builderCtx.LibraryDirs, libPath)
136+
}
132137
if req.GetBuildPath() == "" {
133138
builderCtx.BuildPath = sk.DefaultBuildPath()
134139
} else {

0 commit comments

Comments
 (0)