Skip to Main Content Skip to Search
Product Documentation

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

Syntax

updateFilePathsAndExtensions(buildinfo, extensions)

extensions is optional.

Arguments

buildinfo

Build information returned by RTW.BuildInfo.

extensions (optional)

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 folder contains myfile.c and myfile.cpp, an instance of myfile would be updated to myfile.c.

Description

Using paths that already exist in the model 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

Examples

Create the folder path etcproj/etc in your working folder, add files etc.c, test1.c, and test2.c to the folder etc. This example assumes the working folder is w:\work\BuildInfo. From the working folder, 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.c

See Also

addIncludeFiles | addIncludePaths | addSourceFiles | addSourcePaths | updateFileSeparator

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS