@@ -65,7 +65,7 @@ public function watch($options = array()) {
6565 // DEPRECATED
6666 /*if ($reload) {
6767 $path = str_replace("lib".DIRECTORY_SEPARATOR."PatternLab","autoReloadServer.php",__DIR__);
68- $fp = popen("php ".$path." -s", "r");
68+ $fp = popen("php ".$path." -s", "r");
6969 Console::writeLine("starting page auto-reload...");
7070 }*/
7171
@@ -82,11 +82,12 @@ public function watch($options = array()) {
8282 Console::writeLine ("watching your site for changes... " );
8383
8484 // default vars
85- $ publicDir = Config::getOption ("publicDir " );
86- $ sourceDir = Config::getOption ("sourceDir " );
87- $ ignoreExts = Config::getOption ("ie " );
88- $ ignoreDirs = Config::getOption ("id " );
89- $ patternExt = Config::getOption ("patternExtension " );
85+ $ publicDir = Config::getOption ("publicDir " );
86+ $ sourceDir = Config::getOption ("sourceDir " );
87+ $ patternSourceDir = Config::getOption ("patternSourceDir " );
88+ $ ignoreExts = Config::getOption ("ie " );
89+ $ ignoreDirs = Config::getOption ("id " );
90+ $ patternExt = Config::getOption ("patternExtension " );
9091
9192 // run forever
9293 while (true ) {
@@ -95,15 +96,15 @@ public function watch($options = array()) {
9596 $ cp = clone $ o ->patterns ;
9697
9798 // iterate over the patterns & related data and regenerate the entire site if they've changed
98- $ patternObjects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ sourceDir . " /_patterns/ " ), \RecursiveIteratorIterator::SELF_FIRST );
99+ $ patternObjects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ patternSourceDir ), \RecursiveIteratorIterator::SELF_FIRST );
99100
100101 // make sure dots are skipped
101102 $ patternObjects ->setFlags (\FilesystemIterator::SKIP_DOTS );
102103
103104 foreach ($ patternObjects as $ name => $ object ) {
104105
105106 // clean-up the file name and make sure it's not one of the pattern lab files or to be ignored
106- $ fileName = str_replace ($ sourceDir . " /_patterns " .DIRECTORY_SEPARATOR ,"" ,$ name );
107+ $ fileName = str_replace ($ patternSourceDir .DIRECTORY_SEPARATOR ,"" ,$ name );
107108 $ fileNameClean = str_replace (DIRECTORY_SEPARATOR ."_ " ,DIRECTORY_SEPARATOR ,$ fileName );
108109
109110 if ($ object ->isFile () && (($ object ->getExtension () == $ patternExt ) || ($ object ->getExtension () == "json " ) || ($ object ->getExtension () == "md " ))) {
@@ -168,10 +169,10 @@ public function watch($options = array()) {
168169 }
169170
170171 // iterate over annotations, data, meta and any other _ dirs
171- $ watchDirs = glob ($ sourceDir ." / _* " ,GLOB_ONLYDIR );
172+ $ watchDirs = glob ($ sourceDir .DIRECTORY_SEPARATOR . " _* " ,GLOB_ONLYDIR );
172173 foreach ($ watchDirs as $ watchDir ) {
173174
174- if (str_replace ( $ sourceDir . " / " , "" , $ watchDir) != " _patterns " ) {
175+ if ($ watchDir != $ patternSourceDir ) {
175176
176177 // iterate over the data files and regenerate the entire site if they've changed
177178 $ objects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ watchDir ), \RecursiveIteratorIterator::SELF_FIRST );
@@ -181,7 +182,7 @@ public function watch($options = array()) {
181182
182183 foreach ($ objects as $ name => $ object ) {
183184
184- $ fileName = str_replace ($ sourceDir ." / " ,"" ,$ name );
185+ $ fileName = str_replace ($ sourceDir .DIRECTORY_SEPARATOR ,"" ,$ name );
185186 $ mt = $ object ->getMTime ();
186187
187188 if (!isset ($ o ->$ fileName )) {
@@ -205,7 +206,7 @@ public function watch($options = array()) {
205206 // iterate over all of the other files in the source directory and move them if their modified time has changed
206207 if ($ moveStatic ) {
207208
208- $ objects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ sourceDir ." / " ), \RecursiveIteratorIterator::SELF_FIRST );
209+ $ objects = new \RecursiveIteratorIterator (new \RecursiveDirectoryIterator ($ sourceDir .DIRECTORY_SEPARATOR ), \RecursiveIteratorIterator::SELF_FIRST );
209210
210211 // make sure dots are skipped
211212 $ objects ->setFlags (\FilesystemIterator::SKIP_DOTS );
0 commit comments