Skip to content

Commit

Permalink
Update path helper to not format Phar paths
Browse files Browse the repository at this point in the history
This should resolve a lot of the issues we're having with the standalone, due to Phar paths being formatted like `'H:\monorepo/phar://foo'`, when they should be unchanged (`'phar://foo'`)
  • Loading branch information
caendesilva committed Dec 12, 2023
1 parent 13c92b2 commit ed60192
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/framework/src/Foundation/Kernel/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public function path(string $path = ''): string
return $this->getBasePath();
}

if (str_starts_with($path, 'phar://') ) {
return $path;
}

$path = unslash($this->pathToRelative($path));

return path_join($this->getBasePath(), $path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public function testPathMethodResolvesAlreadyAbsolutePathsUsingHelperWithTrailin
$this->assertSame($this->filesystem->path('foo'), $this->filesystem->path($this->filesystem->path('foo/')));
}

public function testPathMethodDoesNotModifyPharPaths()
{
$this->assertSame('phar://foo', $this->filesystem->path('phar://foo'));
}

public function testHydePathMethodExists()
{
$this->assertTrue(method_exists(HydeKernel::class, 'path'));
Expand Down

0 comments on commit ed60192

Please sign in to comment.