Skip to content

Add getResourceFiles function #4543

@Fernando-A-Rocha

Description

@Fernando-A-Rocha

Is your feature request related to a problem? Please describe.

Resources have files listed in their meta.xml. Files need to be listed there in order for certain functions to work like downloadFile (clientside) or fileGetContents (shared).

Developers have no way of knowing via scripting if a file (using its path) is in a resource's meta.xml.

Problem 1: you want to make a file download system. You use pathListDir to obtain files in a folder. These files should be listed in meta.xml but you don't know for sure. You want to ask the client to download only certain files that you know are listed, to avoid errors. You have no function to find them, other than manually parsing the resource's meta.xml and sending that info to the client. If you do that, you will have even more difficulty parsing the newly added globs used to load files dynamically like models/*.dff.

Describe the solution you'd like

New shared function getResourceFiles(resource theResource [, bool includeAttributes = false ])
Returns table with file paths.
If includeAttributes is true it returns a table with file paths as key and the node attributes, like download = "false".

Describe alternatives you've considered

x

Additional context

PR #3603 was almost ready but it was abandoned unfortunately

Security Policy

  • I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions