Subject: | PROCESS "directory" fills cache dir with empty file called "directory" instead of directory |
PROCESS "directory"
where "directory" is the name of a directory that exists is successful
where it should fail. open() does not fail on a directory so the PROCESS
proceeds as though it is reading an empty file.
It is an error on the part of the dev to try to process a directory as
it has no meaning so TT should catch this.
Moreover if caching is enabled then this introduces a bug that prevents
templates within "directory" from being processed. This occurs because
the directory structure for the templates is replicated in the cache
directory. E.g. If I have a file "templates/profiles/user.tmpl" and
template TT2 to PROCESS "profiles" then it proceeds without error.
The cache file for this template is "cachedir/profiles" but since it was
considered a 0b file this cachedir/profiles is a file not a directory.
Accordingly if I then process templates/profiles/user.tmpl then the
corresponding cache file is "cachedir/profiles/user.tmpl", but this file
fails to be created because cachedir/profiles is a file, not a directory.
For a patch please see
https://github.com/abw/Template2/pull/12