Main Content

updateFilePathsAndExtensions

Update files in model build information with missing paths and file extensions

Description

example

updateFilePathsAndExtensions(buildinfo,extensions) specifies the file name extensions (file types) to include in search and update processing.

Using paths from the build information, the updateFilePathsAndExtensions function checks whether file references in the build information require an updated path or file extension. Use this function to:

  • Maintain build information for a toolchain that requires the use of file extensions.

  • Update multiple customized instances of build information for a given model.

If you use updateFilePathsAndExtensions, you call it after you add files to the build information. This approach minimizes the potential performance impact of the required disk I/O.

Examples

collapse all

In your working folder, create the folder path etcproj/etc , add files etc.c, test1.c, and test2.c to the folder etc. For this example, the working folder is w:\work\BuildInfo. From the working folder, update build information myModelBuildInfo with 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.c'

Input Arguments

collapse all

The extensions argument specifies the file name extensions (file types) to include in search and update processing. 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 folder contains myfile.c and myfile.cpp, an instance of myfile is updated to myfile.c.

Example: '.c' '.cpp'

Introduced in R2006a