Maybe there's an easy way to do this, and I've just missed it, but...
We have init.bsh and finally.bsh, each of which is run once per album build. Then we have postdir.bsh, which is run after each directory is processed. But there's no corresponding predir.bsh, as far as I know. It would be run just before each directory is processed.
I suppose I can simulate it by calling a routine from index.htt, and checking to see if indexNum is void or one before actually letting it do anything. Seems clunky, however.
A simple case: in Matrix, I need to do some computations to determine the height of the thumbnail boxes on the pages. I want the same height on all index pages for this directory (index, index2, index3, etc.). I do a quick iteration through all the items in this directory to pick up some needed information.
I can't do this in init.bsh, because there will be different values for different directories. If I do it in index.htt, it's doing the routine when it creates index.html, then again when it creates index2.html, and so on. It needs to do it only once for the directory. So, I'm checking for indexNum equals void or one, so I do the routine only once. It works, but it's clumsy.
Similarly, it's sometimes necessary to set a variable for a directory, like isSomething=false, to keep track of whether something is present in the directory. As each item is processed, isSomething may be set to true. In postdir.bsh, I want to use that variable. For the next directory, however, I want to start out with it set to false again.
I see, Let me consider it. Personally I don't think it sounds that clunky to do that stuff within index.htt using an if test. If we introduce a predir.bsh that also has the downside of making the skin require an update to jAlbum.
It's not a big deal - just something I ran into when I was getting confused about whether I needed to set some variables at the album level, the directory level, or the page level, and suddenly realized there was no truly direct way of doing something at the directory level.
(Part of the same exercise, really, and the one I'm more interested in, is the "local" problem I've run into with iterating through the folders in a directory - thread in the General Development section. I ran into that one at the same time, since it involves doing something for an entire directory, regardless of page boundaries.)
Lots of skin changes require the latest version of jAlbum, so that never worries me. Most of the current versions of the bundled skins won't run with anything before jAlbum 10, for example, because of the licensing checks.
I had a similar requirement (don't bother looking for it - it isn't published yet). In index.htt, in fileIterator, I check whether or not the current file is a directory. If it is, I scan the sub-folder and do some set-up work. It was easy.
My objective was to automatically exclude some files from the album. Since jAlbum does not start to work with the sub-folders until the parent folder has been generated, I can manipulate the sub-folder from within the parent folder's iteration of index.htt.
For the root folder, I had to replicate the code in init.bsh. This is the only downside of this approach; the code has to be in 2 places (if there were a predir.bsh it would be in one place). However, this is a minor point.