Escape characters in include path [Windows 10]

In my platformio.ini i’m using build_flags to control integration of certain configuration files during compile time:

build_flags =
    -include "src/hal/${PIOENV}.h"
    -include "src/paxcounter.conf"

In c_cpp_properties.json this causes a json error:

"compilerPath": "C:/Users/FooBar/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc.exe  -Wno-old-style-declaration -include src\hal\lopy4.h -include src\paxcounter.conf -w -mfix-esp32-psram-cache-issue -Os -Wall -nostdlib -Wpointer-arith -Wno-error=unused-but-set-variable -Wno-error=unused-variable -mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wno-error=deprecated-declarations -Wno-error=unused-function -Wno-unused-parameter -Wno-sign-compare -fstack-protector -fexceptions"
        }

[json] Invalid escape character in string. [261]

Besides that the generated c_cpp_properties.json has no property version which results to another error.

This is a bug. Thanks! I’ve just fixed it. Please open PIO IDE Terminal and type pio upgrade --dev. Restart VSCode.

1 Like

Thanks! I tested it, it works.

I have a related problem, which i could not solve yet.
I want to change a relative path setting in a DEFINE in platformio.ini to an absolute path:

build_flags_basic =
       '-DARDUINO_LMIC_PROJECT_CONFIG_H=../../../src/lmic_config.h'

I want to set absolute path using $PROJECT_DIR.
Tried several variants, but on an Windows10 system every variant results in an invalid path setting.

How about Advanced Scripting?