Skip to content

Commit af7628d

Browse files
committed
AllowLoad: glue addon files are now ignored
1 parent 395691f commit af7628d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bin/annotate

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ if (is_file($inputDir) && (str_ends_with($inputDir, '.lua') || str_ends_with($in
3939
$inputDir = rtrim($inputDir, '/');
4040
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($inputDir));
4141
$iterator->rewind();
42+
43+
$tocFiles = [];
4244
/** @var $iterator RecursiveDirectoryIterator */
4345
while ($iterator->valid()) {
4446
if (
@@ -47,8 +49,24 @@ if (is_file($inputDir) && (str_ends_with($inputDir, '.lua') || str_ends_with($in
4749
) {
4850
$fileList[$iterator->getPath() . '/' . $iterator->getFilename()] = $iterator->getExtension();
4951
}
52+
if ('toc' === $iterator->getExtension()) {
53+
$tocFiles[] = $iterator->getPath() . '/' . $iterator->getFilename();
54+
}
5055
$iterator->next();
5156
}
57+
58+
foreach ($tocFiles as $tocFile) {
59+
$toc = file_get_contents($tocFile);
60+
if (str_contains($toc, '## AllowLoad: glue')) {
61+
// remove all files with shared basepath from $fileList
62+
$basePath = dirname($tocFile);
63+
foreach ($fileList as $filePath => $extension) {
64+
if (str_starts_with($filePath, $basePath)) {
65+
unset($fileList[$filePath]);
66+
}
67+
}
68+
}
69+
}
5270
}
5371

5472
$intrinsicRegistry = new Registry();

0 commit comments

Comments
 (0)