Skip to content

Includedir recursive option#517

Open
KhallG wants to merge 5 commits intoNebulousCloud:masterfrom
KhallG:includedir-recursive-option
Open

Includedir recursive option#517
KhallG wants to merge 5 commits intoNebulousCloud:masterfrom
KhallG:includedir-recursive-option

Conversation

@KhallG
Copy link
Copy Markdown

@KhallG KhallG commented Dec 15, 2025

feat(util): add optional recursive parameter to IncludeDir

Add bRecursive parameter to ix.util.IncludeDir to allow optional
recursive inclusion of subdirectories. When false, only files in
the specified directory are included, without traversing subdirectories.

  • Add bRecursive as third optional parameter
  • Add file extension check to filter .lua files only
  • Update function documentation with new parameter
  • Maintain backward compatibility

Refactor the IncludeDir function to improve clarity and structure.
Removed undo functionality for container creation.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds optional recursive directory inclusion functionality to the ix.util.IncludeDir function, allowing developers to optionally include Lua files from subdirectories when loading plugins or schemas.

Key changes:

  • Added bRecursive as a third optional parameter to control recursive subdirectory traversal
  • Modified file.Find to return both files and directories by changing the pattern from /*.lua to /*
  • Added explicit .lua file extension filtering using string.EndsWith

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +97 to +99
for _, d in ipairs(dirs) do
ix.util.IncludeDir(directory.."/"..d, bFromLua, bRecursive)
end
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'dirs' variable returned from file.Find may be nil if no directories are found. Attempting to iterate over nil with ipairs will cause a runtime error. The dirs variable should be checked for nil or defaulted to an empty table before iteration.

Copilot uses AI. Check for mistakes.
Comment on lines +89 to +93
for _, v in ipairs(files) do
if (string.EndsWith(v, ".lua")) then
ix.util.Include(directory.."/"..v)
end
end
Copy link

Copilot AI Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'files' variable returned from file.Find may be nil if no files are found. Attempting to iterate over nil with ipairs will cause a runtime error. The files variable should be checked for nil or defaulted to an empty table before iteration.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants