Coming to you again with a weird phenomenon that happened to me, still working for Respiraworks.
I hadn’t tested this for some time, but it appears now that building for one of the environments which uses a different src_dir than src/ does not work anymore: platformio still includes main.cpp from the src dir, and does not include the other directory.
When in this project, platformio run -e copy_env builds properly even if src_copy/main.cpp should clearly fail compilation.
As a matter of fact, it is bringing me a warning from src/main.cpp (which should be excluded): src/main.cpp:9:7: warning: unused variable 'i' [-Wunused-variable] , and we can see in verbose mode that it DOES build src/main.cpp, and does not build src_copy/main.cpp.
Illustrated by:
The weird thing is that it did work a few months ago without making the paths relative to src/. The last time I used other environments was in late 2020 and I so I can’t really pinpoint when this changed.
As an afterthought, are you sure you don’t just want to change the complete src_dir to just re-point the main source directory from src/ to something else?
Indeed, using src_dir=./ with src_filter only including the desired directory for each environment works as well, and looks simpler to follow.
Will check with other members of the team which option is best suited for our needs, but I find this second one more straightforward.
If you do this then also include/ and lib/ are maybe seen as normal source directories which might break the library dependency finder. I meant more src_dir = src copy and src_dir = src as options.
Indeed, what I had in mind with src_dir=./ was ditching env.src_filter altogether and having src_filter = +<desired_folder/> in each environment, so it only matches the desired folder. Which is pretty much how the project structure was designed: all of the common source code is actually in lib/ and each environment has its own src directory (containing the main.cpp file, some environment-specific headers and some non-code files).