1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950(* YOCaml a static blog generator.
Copyright (C) 2025 The Funkyworkers and The YOCaml's developers
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. *)letiter=Action.batch_listletfold=Action.fold_listletiter_children=Action.batchletfold_children=Action.foldletiter_files=iter_children~only:`Filesletiter_directories=iter_children~only:`Directoriesletfold_files?where~state=fold_children~only:`Files?where~stateletfold_directories?where~state=fold_children~only:`Directories?where~stateletfold_tree?(where=fun__->true)~statepathaction=letrecauxstatepath=fold_children~only:`Both~statepath(funpathstatecache->letopenEffinlet*is_file=is_file~on:`Sourcepathinifis_file&&where`Filepaththenactionpathstatecacheelselet*is_dir=is_directory~on:`Sourcepathinifis_dir&&where`Directorypaththenauxstatepathcacheelsereturn(cache,state))inauxstatepathletiter_tree?wherepathactioncache=letopenEffinlet+cache,()=fold_tree?where~state:()path(funpath()cache->let+cache=actionpathcachein(cache,()))cacheincache