Main Content

listRequiredFiles

Get files required by specified project files

Description

requiredfiles = listRequiredFiles(proj,files) returns the paths of the project files that the specified files require to run.

example

requiredfiles = listRequiredFiles(proj,files,Name=Value) specifies additional options as one or more name-value arguments. For example, to find the required files only in the specified project proj, set the AnalyzeReferences argument to false.

example

Examples

collapse all

Open the Times Table App project. Use currentProject to create a project object.

openExample("matlab/TimesTableProjectExample")
proj = currentProject;

Get the files required by the Times Table app file.

file = "source/timestable.mlapp"
requiredfiles = listRequiredFiles(proj,file)
requiredfiles = 

  2×1 string array

    "C:\myProjects\examples\TimesTableApp\source\timestable.mlapp"
    "C:\myProjects\examples\TimesTableApp\source\timesTableGame.m"

Open a project that references other projects. Use currentProject to create a project object.

openProject("example/project/path")
proj = currentProject;

Get the files required by the myscript file and that belong only to the open project.

file = "source/myscript"
requiredfiles = listRequiredFiles(proj,file,AnalyzeReferences=false);

Input Arguments

collapse all

Project, specified as a matlab.project.Project object. Use currentProject to create a project object from the currently loaded project.

Path of project files including file extensions, specified as a cell array of character vectors, a string array, or a ProjectFile object array. Specify files as absolute file paths or paths relative to the project root folder. The files must be within the project root folder.

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: listRequiredFiles(proj,AnalyzeReferences=true,UpdateDependencies=false)

Option to look for files inside referenced projects, specified as a numeric or logical 1 (true) or 0 (false).

Data Types: logical

Option to update dependencies before running the analysis, specified as a numeric or logical 1 (true) or 0 (false).

Setting UpdateDependencies to false runs a faster analysis but does not update the graph information. If a lot of files changed since the last dependency analysis, for accurate results, set UpdateDependencies to true.

Data Types: logical

Output Arguments

collapse all

Required project files, returned as a string array.

Version History

Introduced in R2019a

expand all