diff --git a/src/classes/Obey/Front/InputResolver.php b/src/classes/Obey/Front/InputResolver.php index c6b3422..ad277c5 100644 --- a/src/classes/Obey/Front/InputResolver.php +++ b/src/classes/Obey/Front/InputResolver.php @@ -19,7 +19,7 @@ class InputResolver public function resolve(Unit $unit) { - $inputPattern = Path::cat($this->getRootDir(), $unit->getGroup()->getInputPattern()); + $inputPattern = Path::norm(Path::cat(getcwd(), $this->getRootDir(), $unit->getGroup()->getInputPattern())); $inputFile = str_replace('*', $unit->getName(), $inputPattern); $unit->setInputFile($inputFile); } diff --git a/src/classes/Obey/Front/OutputResolver.php b/src/classes/Obey/Front/OutputResolver.php index 32ebaa5..876070d 100644 --- a/src/classes/Obey/Front/OutputResolver.php +++ b/src/classes/Obey/Front/OutputResolver.php @@ -27,11 +27,12 @@ class OutputResolver public function resolve(Unit $unit) { - $outputPattern = Path::cat( + $outputPattern = PAth::norm(Path::cat( + getcwd(), $this->getOutputDir(), $unit->getGroup()->getSubDir(), $this->getOutputNameTemplate() - ); + )); $outputFile = str_replace('{}', $unit->getName(), $outputPattern); $unit->setOutputFile($outputFile); } diff --git a/src/classes/Obey/PathHelper.php b/src/classes/Obey/PathHelper.php index 276d3f6..245edbf 100644 --- a/src/classes/Obey/PathHelper.php +++ b/src/classes/Obey/PathHelper.php @@ -9,9 +9,14 @@ public static function cat(?string ...$fragments) : string { $nonNullFragments = array_filter($fragments,fn($v) => null!==$v); if (0===count($nonNullFragments)) return "."; + $absoluteTail = []; + foreach($nonNullFragments as $fragment) { + if (self::isAbsolute($fragment)) $absoluteTail=[$fragment]; + else $absoluteTail[] = $fragment; + } $explodedFragments = [ - self::split($nonNullFragments[0]), - ...array_map(fn($fragment) => self::split($fragment,false), array_slice($nonNullFragments,1)) + self::split($absoluteTail[0]), + ...array_map(fn($fragment) => self::split($fragment,false), array_slice($absoluteTail,1)) ]; $segments = array_merge(...$explodedFragments); if (!count($segments)) return ".";