I noticed that the Lucee implementation of directoryList differs from the ACF usage.
ACF requires a filter UDF to have the arguments “path”, “type” and “extension” while Lucee only supports the argument “path”.
Is this inconsistency planned? It would be nice to be compatible to ACF here so that code can be migrated from ACF without a problem.
From the ACF docs:
File extension filter applied to returned names, for example, *.cfm. Multiple filters can be applied by using a pipe delimiter. For example: .beer|.cookies
Also, you can pass a function in the filter argument:
[ … ]
The arguments of the passed functions must have:
- path: The file path
- type: The values (file or dir )
- extension: The file extension if any otherwise an empty string
Additionally, it can also accept the instances of Java FileFilter Objects.
From the Lucee docs:
Filter to be used to filter the results:
- A string that uses “" as a wildcard, for example, ".cfm”
- a UDF (User defined Function) with signature Boolean function(String path). The function is run for each file in turn; if the function returns true, then the file is will be added to the result; otherwise it will be omitted.