Hello,
I encountered a strange behavior in the function find_files(). Seems like a bug, but I'm asking confirmation.
When using an absolute path, the function returns "true". I was expecting the file name I passed in.
Exemple Fuel::find_files('whatever', '/an/existing/file') returns true. I think it should return '/an/existiing/file'.
Should I file the bug report?
Sorry for spamming, but if I want to suggest something else. Why not using is_file() insteald of file_exists().
file_exsits() returns true for files and directories, is_file() returns true only for files.
Because Fuel::find_file() is, as the name implies, about finding files. It's not about finding directories.
Most Fuel code that uses this method (for example when loading views or config files) would choke terribly when a directory would be returned.
This is indeed a bug, which has been corrected now. Fuel itself doesn't load anything by absolute path, so it wasn't impacted by this bug.
Question is why you would want to use Fuel::find_file() if you have an absolute filename (which is clearly already found). A simple is_file(); would be a lot quicker than calling find_file.
In fact, I'm trying to instanciate a View object by using a full absolute path, like this: View::factory('/absolute/path/to/view.php');
So the whole file and directory structure get passed in the $file parameter by View::set_filename(), ignoring the $directory and $ext parameters from Fuel::find_files().
So I can't split up the directory and the file name (because the View handles it).
[edit] Forget all below this since it has been confirmed as a bug.
But still when using in a standalone manner Fuel::find_file() to find an file using and absolute path , that doesn't work. The file I'm searching is not within the $paths directories. It's an actual absolute path, form the root of the disk.
When reading the code, the function seems to handles the case but incorrectly. The $directory and $ext parameters are not ignored when trying to find a file with an absolute path.
Maybe it's not supposed to be used this manner? If possible I would like to avoid adding a global search path.