How to handle absolute paths in Polyspace option files?

I'm trying to setup Polyspace as You Code in Visual Studio Code. I'm using an options file for project settings.
It seems only possible to set include paths as absolute paths. This isn't practical with version control, because the workspace directory can vary. Manual editing of the paths at each checkout would be required. A similar problem regarding the project file was addressed here: Can the Polyspace project configuration file use relative instead of absolute path names? - MATLAB Answers - MATLAB Central. For the project file this is not such a huge problem (but still inconvenient) because the paths are adapted automatically by the Bug Finder. Polyspace as You Code doesn't seem to do this.
How are you supposed to use Polyspace as You Code with version control?
Are there options to use relative paths to the workspace directory or use some kind of placeholder or environment variables in the path?

 Accepted Answer

Hello Jonathan,
at the moment relative paths for the include paths of Polyspace As You Code do not work because the analyses are run in a temporary folder, thus the relative paths cannot be resolved there.
You can use polyspace-configure to create the includes per checkout location or check in a template options file with placeholder variables and expand those script-based (e.g. with the Linux commands "envsubst" , "sed" or equivalent) to create the options file (that is git-ignored).
See this documentation page:
Michael

1 Comment

Thank you for the response.
Further analysis has shown, that the problem was caused by an incomplete compile_commands.json file. When it contains the correct include paths, its is superfluous to add the include paths in an options file.

Sign in to comment.

More Answers (0)

Products

Release

R2025b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!