-
-
Notifications
You must be signed in to change notification settings - Fork 429
Description
Describe the problem
In a sketch.yaml profile, you can specify local libraries as dir: <LOCAL_LIB_PATH> (#2930). According to the documentation, "The path could be absolute or relative to the sketch folder." This works correctly if you just run arduino-cli compile from inside the sketch folder or if you pass a path to the sketch folder like arduino-cli compile Sketch. But if you specify the sketch filename on the command line like arduino-cli compile Sketch/Sketch.ino, then it interprets local library paths relative to this sketch file instead of the sketch folder.
To reproduce
- Create a project folder.
- Within that, create a
Libraries/TestLibfolder with aTestLib.handTestLib.cppin it. - In the project folder, also create a
Sketch/Sketch.inofile that has#include <TestLib.h> - Create
Sketch/sketch.yamlthat has a default profile that includes in itslibraries:sectiondir: ../Libraries/TestLib - From the project folder, run
arduino-cli compile Sketch. This will work. - From the project folder, run
ardunio-cli compile Sketch/Sketch.ino. This will fail with the error message:Error initializing instance: Invalid library directory in sketch project: ../Libraries/TestLib - If you changed the library path in
sketch.yamltodir: ../../Libraries/TestLiband then run the command in step 6 it will work, but now the command from step 5 won't.
Expected behavior
My expectation is that the filename should be stripped if specified and relative paths should always be relative to the folder whether a file is specified or not. The library path should be dir: ../Libraries/TestLib and work in both steps 5 and 6.
Arduino CLI version
1.3.1
Operating system
Windows
Operating system version
11
Additional context
No response
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the nightly build
- My report contains all necessary details