The Filesystem helper defines the get_filenames($source_dir[, $include_path = FALSE]) function, described in the User Guide:
Quote:Takes a server path as input and returns an array containing the names of all files contained within it. The file path can optionally be added to the file names by setting the second parameter to TRUE.
The function has two different return types contingent on its second parameter. The first (default) is a flat list of all files in all subdirectories:
Code:
document.txt
cat.jpg
rainbow.exe
And the second is the same files by their absolute paths:
Code:
/var/www/html/mysite/document.txt
/var/www/html/mysite/assets/cat.jpg
/var/www/html/mysite/downloads/cached/rainbow.exe
My question to you all: why would the first return type ever be useful? I keep coming back to this function forgetting its "flattening" effect and being disappointed that I can't get the
relative paths:
Code:
document.txt
assets/cat.jpg
downloads/cached/rainbow.exe
The default return case is never used in the framework itself, and my opinion is that it should return the relative path instead of just the filename. With the relative path it would still be easy to acquire the flat filename, e.g. with pathinfo() and array_map().
Anyone with experience of the Filesystem helper have input?