--- Return an iterator for the list of source code files contained by a project.
--- The project to query.
--- A source code file iterator, which returns file configuration objects.
--- These file configurations contain:
--- fullpath - the relative path from the project to the file
--- vpath - the file's virtual path, if specified, or fullpath if not
- function project.eachfile(prj)
- -- make sure I have the project, and not it's root configuration
- prj = prj.project or prj
- -- find *all* files referenced by the project, regardless of configuration,
- -- and cache the list for future calls
- for _, block in ipairs(prj.blocks) do
- for _, file in ipairs(block.files) do
- if not files[file] then
- local fcfg = project.getfileconfig(prj, file)
- -- add it both indexed for iteration and keyed for quick tests
- table.insert(files, file)
- local files = prj.files
- local filename = files[i]
-- Locate a project by name; case insensitive.
+ -- make sure I have the project, and not it's root configuration
+ prj = prj.project or prj
-- check for a previously cached tree
+ -- find *all* files referenced by the project, regardless of configuration
+ for _, block in ipairs(prj.blocks) do
+ for _, file in ipairs(block.files) do
+ -- create a tree from the file list
+ local tr = premake.tree.new(prj.name)
- local tr = premake.tree.new(prj.name)
+ for file in pairs(files) do
+ local fcfg = project.getfileconfig(prj, file)
- for fcfg in project.eachfile(prj) do
-- The tree represents the logical source code tree to be displayed
-- in the IDE, not the physical organization of the file system. So
-- virtual paths are used when adding nodes.
- -- Store additional path information for file (leaf) nodes
- node.abspath = fcfg.abspath
- node.relpath = fcfg.relpath
- node.vpath = fcfg.vpath
+ -- Store full file configuration in file (leaf) nodes
+ for key, value in pairs(fcfg) do