Replacing the path to your source files
You can replace or simply shorten the directory structure for source files displayed in Klocwork tools with the kwbuildproject option --replace-path <original>=<new>. This option replaces one substring in the absolute file path with a user-defined path.
Replacing the path to source files is helpful in two situations:
- When the source files are located deep in the file system tree. You can specify a build prefix to remove unnecessary directories displayed in all Klocwork tools (such as Klocwork Static Code Analysis reports).
- When the source files for each analysis run are stored in a separate location. You can specify a build prefix to keep model and source file paths persistent from build to build.
For example, the kwbuildproject option
--replace-path /dev/projects/project1/v_03/source=/source
causes all path names to source files displayed in Klocwork tools to start with /source instead of /dev/projects/project1/v_03/source.
Tip: f you make a mistake in setting the --replace-path option, run kwbuildproject again with the option set properly.