Skip to content

Commit 60fc319

Browse files
committed
Enabling the ability for Pattern Lab to follow any symlinks that may exist when scanning the pattern source directory for patterns; adds the RecursiveIteratorIterator flag to follow symbolic links while still continuing to skip dots (. and ..).
This opens the door for some creative workarounds to the rigid way Pattern Lab expects pattern templates to be organized at the file system level + how the physical path to a pattern determines how it's organized in Pattern Lab... pattern-lab#28
1 parent 2db3557 commit 60fc319

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Diff for: src/PatternLab/PatternData.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,14 @@ public static function gather($options = array()) {
116116
if (!is_dir(Config::getOption("patternSourceDir"))) {
117117
Console::writeError("having patterns is important. please make sure you've installed a starterkit and/or that ".Console::getHumanReadablePath(Config::getOption("patternSourceDir"))." exists...");
118118
}
119-
$patternObjects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(Config::getOption("patternSourceDir")), \RecursiveIteratorIterator::SELF_FIRST);
120-
$patternObjects->setFlags(\FilesystemIterator::SKIP_DOTS);
119+
120+
$patternSourceDir = Config::getOption("patternSourceDir");
121+
$patternObjects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($patternSourceDir, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS | \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
121122

122123
// sort the returned objects
123124
$patternObjects = iterator_to_array($patternObjects);
124125
ksort($patternObjects);
125126

126-
$patternSourceDir = Config::getOption("patternSourceDir");
127-
128127
foreach ($patternObjects as $name => $object) {
129128

130129
$ext = $object->getExtension();

0 commit comments

Comments
 (0)