Skip to content

Commit

Permalink
Fix page paths on Windows (indirectly resolves #513 #514)
Browse files Browse the repository at this point in the history
  • Loading branch information
giuscris committed Jun 2, 2024
1 parent e39fe86 commit f56ccae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions formwork/src/Pages/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public function retrievePages(string $path, bool $recursive = false): PageCollec
$pages = [];

foreach (FileSystem::listDirectories($path) as $dir) {
$pagePath = FileSystem::joinPaths($path, $dir, DS);
$pagePath = FileSystem::joinPaths($path, $dir, '/');

if ($dir[0] !== '_' && FileSystem::isDirectory($pagePath)) {
$page = $this->retrievePage($pagePath);
Expand Down Expand Up @@ -330,7 +330,7 @@ public function findPage(string $route): ?Page
$found = false;
foreach (FileSystem::listDirectories($path) as $dir) {
if (preg_replace(Page::NUM_REGEX, '', $dir) === $component) {
$path .= $dir . '/';
$path .= FileSystem::joinPaths($dir, '/');
$found = true;
break;
}
Expand Down
6 changes: 5 additions & 1 deletion formwork/src/Panel/Controllers/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,11 @@ protected function createPage(FieldCollection $fieldCollection): Page

$scheme = $this->app->schemes()->get('pages.' . $fieldCollection->get('template')->value());

$path = $parent->path() . $this->makePageNum($parent, $scheme->options()->get('num')) . '-' . $fieldCollection->get('slug')->value() . '/';
$path = FileSystem::joinPaths(
(string) $parent->path(),
$this->makePageNum($parent, $scheme->options()->get('num')) . '-' . $fieldCollection->get('slug')->value(),
'/'
);

FileSystem::createDirectory($path, recursive: true);

Expand Down

0 comments on commit f56ccae

Please sign in to comment.