Skip to content

Commit

Permalink
Fix compilable assets when using a mirrored public folder
Browse files Browse the repository at this point in the history
When using a mirrored public folder (i.e. `artisan winter:mirror public`), the working directory for the request is set to base_path('public') instead of base_path(), so it is important to use absolute paths when calling File::exists() as it internally just calls file_exists(), which uses the current working directory to resolve relative paths.

Related:
- wintercms/storm@752c162#diff-58c1a5c5e22fc25e75bb02e4af9d2085cfe66b8cfe7c3cffc2f32a4fb60240aaR31
- laravel/framework#45679
- laravel/framework#13243
  • Loading branch information
LukeTowers committed Oct 30, 2024
1 parent 9d19d71 commit 917fcd1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/system/classes/asset/PackageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function registerPackage(string $name, string $path, string $type = 'mix'
}

// Check that the package path exists
if (!File::exists($path)) {
if (!File::exists(base_path($path))) {
throw new SystemException(sprintf(
'Cannot register "%s" as a compilable package; the "%s" path does not exist.',
$name,
Expand All @@ -318,7 +318,7 @@ public function registerPackage(string $name, string $path, string $type = 'mix'
$package = $path . '/package.json';
$config = $path . DIRECTORY_SEPARATOR . $configFile;

if (!File::exists($config)) {
if (!File::exists(base_path($config))) {
throw new SystemException(sprintf(
'Cannot register "%s" as a compilable package; the config file "%s" does not exist.',
$name,
Expand Down

0 comments on commit 917fcd1

Please sign in to comment.