visual studio code – Setting working directory in VSCode 14.6.x when using CMake Tools to something else then build directory


Since the update of CMake Tools 1.4.2 (Incorrect run folder #1395) the working directory of the launched binary isn’t the workspace directory anymore, but the build directory (due to that files loaded with relative paths are not found anymore).

I tried to figure out in the release notes and the settings if there were some changes that cause that behavior, but I’m not able to find a reason or a solution for that.

The setup is:

  • Linux
  • VSCode 1.14.1
  • CMake Tools 1.4.2

I tried to set the cwd using launch.json, but I’m not able to get it to work.

My launch.json currently looks that way:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

Does anyone know how the working directory can be changed?

Leave a Reply

Your email address will not be published. Required fields are marked *