Polyspace - Relative Paths in Options File

Hello, I'm trying to set the -code-behavior-specifications and the -classification flags for Polyspace as You Code in an options file that gets loaded with -options-file flag.
The options file is stored in our repository, so that all users use the same flags. However, it can be that users clone the repo in different locations, which is why the paths for -code-behavior-specifications and the -classification should be relative!
This works fine, when I call polyspace-bug-finder-access.exe from the command line. However, when using the VSCode extension, that executable gets called in a temporary working directory, and the files are not found when using relative paths.
Is there a placeholder like ${workspaceFolder} that I can use in the options file that resolves to the parent directory of the options file or to a predefined location?
Note: It is possible to load a second -options-file from the options file using a path relative to the options file (at least when both are in the same directory). This is unfortunately not possible with the -code-behavior-specifications and the -classification flags.

Réponses (1)

Paco
Paco il y a environ 19 heures
Modifié(e) : Paco il y a environ 19 heures
I received an answer to this in a support ticket that I created:
"Paths passed directly to Polyspace As You Code are resolved relative to the workspace folder automatically, but there is no such option available at the moment for paths in the options file.
You can use the script mode of PAYC [...]"
So, I created a script that simply changes the working directory to the root of our repository before executing polyspace-bug-finder-access:
#!/bin/bash
:<<'SKIP_THIS_ON_LINUX'
@echo off
@REM This is a script that can be run on both Windows and Linux (bash).
@REM This part is treated as a multi-line comment in bash (until `SKIP_THIS_ON_LINUX`)
@REM We make sure to `EXIT` on Windows before the Linux part starts.
@REM Change working directory to the root of the repository
if not defined REPO_ROOT set "REPO_ROOT=%~dp0..\.."
cd /d "%REPO_ROOT%" || EXIT /B %ERRORLEVEL%
@REM Process script arguments
set SOURCES=%1
set RESULTS_FOLDER=%2
set INSTALL_DIR=%3
set EXTRA_ARGS=
:loop
if "%~4" == "" (
goto :done)
set EXTRA_ARGS=%EXTRA_ARGS% %4
shift
goto :loop
:done
@REM Run Polyspace analysis
set POLYSPACE_EXE=%INSTALL_DIR:"=%\polyspace\bin\polyspace-bug-finder-access.exe
"%POLYSPACE_EXE%" -sources %SOURCES% -results-dir %RESULTS_FOLDER% %EXTRA_ARGS%
EXIT /B %ERRORLEVEL%
@REM The Linux (bash) part starts after the following line:
SKIP_THIS_ON_LINUX

Produits

Version

R2026a

Question posée :

le 18 Mai 2026 à 12:50

Modifié(e) :

il y a environ 19 heures

Community Treasure Hunt

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

Start Hunting!

Translated by