| Real-Time Workshop® | ![]() |
Update files in model's build information with missing paths and file extensions
updateFilePathsAndExtensions(buildinfo, extensions)
extensions is optional.
Build information returned by RTW.BuildInfo.
A cell array of character arrays that specifies the extensions (file types) of files for which to search and include in the update processing. By default, the function searches for files with a .c extension. The function checks files and updates paths and extensions based on the order in which you list the extensions in the cell array. For example, if you specify {'.c' '.cpp'} and a directory contains myfile.c and myfile.cpp, an instance of myfile would be updated to myfile.c.
Using paths that already exist in a model's build information, the updateFilePathsAndExtensions function checks whether any file references in the build information need to be updated with a path or file extension. This function can be particularly useful for
Maintaining build information for a toolchain that requires the use of file extensions
Updating multiple customized instances of build information for a given model
Create the directory path etcproj/etc in your working directory, add files etc.c, test1.c, and test2.c to the directory etc. This example assumes the working directory is w:\work\BuildInfo. From the working directory, update build information myModelBuildInfo with any missing paths or file extensions.
myModelBuildInfo = RTW.BuildInfo;
addSourcePaths(myModelBuildInfo, fullfile(pwd,...
'etcproj', '/etc'), 'test');
addSourceFiles(myModelBuildInfo, {'etc' 'test1'...
'test2'}, '', 'test');
before=getSourceFiles(myModelBuildInfo, true, true);
before
before =
'\etc' '\test1' '\test2'
updateFilePathsAndExtensions(myModelBuildInfo);
after=getSourceFiles(myModelBuildInfo, true, true);
after{:}
ans =
w:\work\BuildInfo\etcproj\etc\etc.c
ans =
w:\work\BuildInfo\etcproj\etc\test1.c
ans =
w:\work\BuildInfo\etcproj\etc\test2.caddIncludeFiles, addIncludePaths, addSourceFiles, addSourcePaths, updateFileSeparator
Programming a Post Code Generation Command
![]() | rsimgetrtp | updateFileSeparator | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |