PlatformIO Community

Using $PROJECT_DIR on WIN10 results in a strange path string

Hello developers,

for my next project I wanted to pick different variable_xxx.h configurations in platformio ini and include them into the main code file.

I found a perfect hint at https://docs.platformio.org/en/latest/projectconf/section_env_build.html#projectconf-build-flags
(Section: -include file Process file as if #include "file" appeared as the first line of the primary source file.)

i tried every possible path configuration so far but the compiler never finds the relevant file.

EXAMPLE:
build_flags =
‘-include $PROJECT_DIR\readerconfigs\variables_${extra.unitid}.h’

Which then expands to:
cc1plus.exe: fatal error: ./ D:\GIT\Projectname\readerconfigs\variables_815.h: Invalid argument

… where does this ./ come from on windows? can I change something to get rid of it in platformio.ini?

Thanks a lot
Chris

If $PROJECT_DIR contains spaces you’re in trouble – you should quote the path.

But anyways, the error you’re getting is separate from that. ./ means “here” / “this directory” in Linux. You should file a bug in https://github.com/platformio/platformio-core/ if PIO prefixes $PROJECT_DIR with that.