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

Commit 573475b

Browse files
committed
more directory separator fixes
1 parent f27f3bf commit 573475b

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

core/lib/PatternLab/Builder.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ protected function gatherPatternInfo() {
507507
$patternType = "";
508508
$patternSubtype = "";
509509
$patternSubtypeSet = false;
510+
$dirSep = DIRECTORY_SEPARATOR;
510511

511512
// initialize various arrays
512513
$this->navItems = array();
@@ -524,7 +525,7 @@ protected function gatherPatternInfo() {
524525
foreach($patternObjects as $name => $object) {
525526

526527
$name = str_replace(__DIR__.$this->sp,"",$name);
527-
$depth = substr_count($name,"/");
528+
$depth = substr_count($name,$dirSep);
528529

529530
// track old types and subtypes for increment purposes
530531

@@ -595,10 +596,10 @@ protected function gatherPatternInfo() {
595596

596597
if ($patternSubtypeSet) {
597598
$patternPath = $patternType."/".$patternSubtype."/".$pattern; // 00-atoms/01-global/00-colors
598-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-01-global-00-colors (file path)
599+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-01-global-00-colors (file path)
599600
} else {
600-
$patternPath = $patternType."/".$pattern; // 00-atoms/00-colors
601-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-00-colors (file path)
601+
$patternPath = $patternType.$dirSep.$pattern; // 00-atoms/00-colors
602+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-00-colors (file path)
602603
}
603604

604605
// track to see if this pattern should get rendered
@@ -608,9 +609,9 @@ protected function gatherPatternInfo() {
608609
if ($patternFull[0] != "_") {
609610

610611
// set-up the names
611-
$patternDash = $this->getPatternName($pattern,false); // colors
612-
$patternClean = str_replace("-"," ",$patternDash); // colors (dashes replaced with spaces)
613-
$patternPartial = $patternTypeDash."-".$patternDash; // atoms-colors
612+
$patternDash = $this->getPatternName($pattern,false); // colors
613+
$patternClean = str_replace("-"," ",$patternDash); // colors (dashes replaced with spaces)
614+
$patternPartial = $patternTypeDash."-".$patternDash; // atoms-colors
614615

615616
// set-up the info for the nav
616617
$patternInfo = array("patternPath" => $patternPathDash."/".$patternPathDash.".html",
@@ -670,11 +671,11 @@ protected function gatherPatternInfo() {
670671

671672
// add to patternPaths
672673
if ($patternSubtypeSet) {
673-
$patternPath = $patternType."/".$patternSubtype."/".$pattern; // 00-atoms/01-global/00-colors
674-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-01-global-00-colors (file path)
674+
$patternPath = $patternType.$dirSep.$patternSubtype.$dirSep.$pattern; // 00-atoms/01-global/00-colors
675+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-01-global-00-colors (file path)
675676
} else {
676-
$patternPath = $patternType."/".$pattern; // 00-atoms/00-colors
677-
$patternPathDash = str_replace("/","-",$patternPath); // 00-atoms-00-colors (file path)
677+
$patternPath = $patternType.$dirSep.$pattern; // 00-atoms/00-colors
678+
$patternPathDash = str_replace($dirSep,"-",$patternPath); // 00-atoms-00-colors (file path)
678679
}
679680

680681
// add all patterns to patternPaths

0 commit comments

Comments
 (0)