Skip to content

Commit

Permalink
Convert paths to relative within the glob helper
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Nov 25, 2022
1 parent 6747c14 commit df81966
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Hyde\Pages\PublicationPage;
use Illuminate\Support\Str;
use Rgasch\Collection\Collection;
use function collect;
use function dirname;
use function glob;
use function Safe\file_get_contents;
Expand All @@ -31,7 +32,7 @@ class PublicationService
public static function getPublicationTypes(): Collection
{
return Collection::create(self::getSchemaFiles())->mapWithKeys(function (string $schemaFile): array {
$publicationType = PublicationType::fromFile(Hyde::pathToRelative($schemaFile));
$publicationType = PublicationType::fromFile($schemaFile);

return [$publicationType->getDirectory() => $publicationType];
});
Expand Down Expand Up @@ -114,6 +115,8 @@ protected static function getPublicationFileData(string $filepath): string

protected static function getSchemaFiles(): array
{
return glob(Hyde::path(Hyde::getSourceRoot()).'/*/schema.json');
return collect(glob(Hyde::path(Hyde::getSourceRoot()).'/*/schema.json'))->each(function (string $path): string {
return Hyde::pathToRelative($path);
})->toArray();
}
}

0 comments on commit df81966

Please sign in to comment.