Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit ce43752

Browse files
committed
correctly referencing publicDir
1 parent 24108be commit ce43752

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

core/lib/PatternLab/FileUtil.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FileUtil {
2424
*/
2525
protected static function moveFile($s,$p) {
2626
if (file_exists(Config::$options["sourceDir"]."/".$s)) {
27-
copy(Config::$options["sourceDir"]."/".$s,__DIR__.Config::$options["patternPublicDir"]."/".$p);
27+
copy(Config::$options["sourceDir"]."/".$s,Config::$options["publicDir"]."/".$p);
2828
}
2929
}
3030

core/lib/PatternLab/Generator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,19 @@ public function generate($enableCSS = false, $moveStatic = true, $noCacheBuster
114114

115115
// clean-up the file name and make sure it's not one of the pattern lab files or to be ignored
116116
$fileName = str_replace(Config::$options["sourceDir"].DIRECTORY_SEPARATOR,"",$name);
117+
117118
if (($fileName[0] != "_") && (!in_array($object->getExtension(),Config::$options["ie"])) && (!in_array($object->getFilename(),Config::$options["id"]))) {
118119

119120
// catch directories that have the ignored dir in their path
120121
$ignoreDir = FileUtil::ignoreDir($fileName);
121122

122123
// check to see if it's a new directory
123-
if (!$ignoreDir && $object->isDir() && !is_dir(__DIR__.Config::$options["patternPublicDir"]."/".$fileName)) {
124-
mkdir(__DIR__.Config::$options["patternPublicDir"]."/".$fileName);
124+
if (!$ignoreDir && $object->isDir() && !is_dir(Config::$options["publicDir"]."/".$fileName)) {
125+
mkdir(Config::$options["publicDir"]."/".$fileName);
125126
}
126127

127128
// check to see if it's a new file or a file that has changed
128-
if (!$ignoreDir && $object->isFile() && (!file_exists(__DIR__.Config::$options["patternPublicDir"]."/".$fileName))) {
129+
if (!$ignoreDir && $object->isFile() && (!file_exists(Config::$options["publicDir"]."/".$fileName))) {
129130
FileUtil::moveStaticFile($fileName);
130131
}
131132

core/lib/PatternLab/Watcher.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ public function watch($reload = false, $moveStatic = true, $noCacheBuster = fals
185185
$ignoreDir = $this->ignoreDir($fileName);
186186

187187
// check to see if it's a new directory
188-
if (!$ignoreDir && $object->isDir() && !isset($o->$fileName) && !is_dir(Config::$options["patternPublicDir"]."/".$fileName)) {
189-
mkdir(Config::$options["patternPublicDir"]."/".$fileName);
188+
if (!$ignoreDir && $object->isDir() && !isset($o->$fileName) && !is_dir(Config::$options["publicDir"]."/".$fileName)) {
189+
mkdir(Config::$options["publicDir"]."/".$fileName);
190190
$o->$fileName = "dir created"; // placeholder
191191
print $fileName."/ directory was created...\n";
192192
}
@@ -195,7 +195,7 @@ public function watch($reload = false, $moveStatic = true, $noCacheBuster = fals
195195
if (file_exists($name)) {
196196

197197
$mt = $object->getMTime();
198-
if (!$ignoreDir && $object->isFile() && !isset($o->$fileName) && !file_exists(Config::$options["patternPublicDir"]."/".$fileName)) {
198+
if (!$ignoreDir && $object->isFile() && !isset($o->$fileName) && !file_exists(Config::$options["publicDir"]."/".$fileName)) {
199199
$o->$fileName = $mt;
200200
FileUtil::moveStaticFile($fileName,"added");
201201
if ($object->getExtension() == "css") {
@@ -225,9 +225,6 @@ public function watch($reload = false, $moveStatic = true, $noCacheBuster = fals
225225
$c = true;
226226

227227
// taking out the garbage. basically killing mustache after each run.
228-
unset($this->pl);
229-
unset($this->msf);
230-
unset($this->mv);
231228
if (gc_enabled()) gc_collect_cycles();
232229

233230
// output anything the reload server might send our way

0 commit comments

Comments
 (0)