microsoft / vscode-arduino

Visual Studio Code extension for Arduino
Other
1.15k stars 201 forks source link

Please generate user-independent paths in c_cpp_properties.json #1270

Open jeffrson opened 3 years ago

jeffrson commented 3 years ago

Unfortunately the extension generates user dependent configurations, like C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\... while ${env:LOCALAPPDATA}/Arduino15/packages/... or ${env:USERPROFILE}/Documents/Arduino/libraries/** is much more convenient for various reasons - last not least when working together in a team keeping c_cpp_properties.json and compiler settings in version control.

For Linux you could probably make use of ${env:HOME} or ~.

Currently, all my thoroughly prepared includePath's are ruined ("translated" or appended another time with user name) when opening the project or compiling the source.

BTW, even on Windows, slashs instead of backslashs could be of advantage.

hlovdal commented 2 years ago

This used to be possible before. I have some older projects with configuration like

        "env": {
                "arduino.path": "${HOME}/.arduino15/packages/arduino",
                "arduino.avr.include.path": "${env:arduino.path}/hardware/avr/1.6.23",
                "arduino.avr.compiler.path": "${env:arduino.path}/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++",
                "arduino.libraries.path": "${HOME}/Arduino/libraries",
                "dummy-last-line": "To allow the second to last line (e.g. the real last line) to always end with a comma"
        },
        "configurations": [
                {
                        "name": "Linux",
                        "includePath": [
                                "./src",
                               "./test",
                                "../arduino_ci/cpp/unittest",
                                "${env:arduino.libraries.path}/SmartLCD",
                                "${env:arduino.avr.include.path}/libraries/Wire/src",
                                "${env:arduino.avr.include.path}/cores/arduino",
                                "${env:arduino.avr.include.path}/variants/standard"
                        ],

but this seems to have been lost in the transition to auto generate the content of c_cpp_properties.json.