Skip to content

Commit

Permalink
Fix asset URL on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
puleeno committed Sep 30, 2023
1 parent 5512375 commit a42eafd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/Core/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@
final class Helper
{
protected static $isDashboard = false;
protected static $updateUpdatePath = null;

public static function createExtensionAssetUrl($extensionDirectory, $path, $minPath = null): AssetUrl
{
$extensionDirectoryUrl = str_replace(ROOT_PATH, '', $extensionDirectory);
if (strpos(PHP_OS, 'WINNT') !== false) {
$extensionDirectoryUrl = str_replace('\\', '/', $extensionDirectoryUrl);
}

return new AssetUrl(
implode(DIRECTORY_SEPARATOR, [$extensionDirectoryUrl, 'assets', $path]),
!empty($minPath) ? implode(DIRECTORY_SEPARATOR, [$extensionDirectoryUrl, 'assets', $minPath]) : null
implode('/', [$extensionDirectoryUrl, 'assets', $path]),
!empty($minPath) ? implode('/', [$extensionDirectoryUrl, 'assets', $minPath]) : null
);
}

Expand Down

0 comments on commit a42eafd

Please sign in to comment.