Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix file locator slash error #2064

Merged
merged 2 commits into from
Jun 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions system/Autoloader/FileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,18 @@ public function locateFile(string $file, string $folder = null, string $ext = 'p
// Check each path in the namespace
foreach ($paths as $path)
{
// Ensure trailing slash
$path = rtrim($path, '/') . '/';

// If we have a folder name, then the calling function
// expects this file to be within that folder, like 'Views',
// or 'libraries'.
if (! empty($folder) && strpos($path . $filename, '/' . $folder . '/') === false)
{
$path .= $folder;
$path .= trim($folder, '/') . '/';
MGatner marked this conversation as resolved.
Show resolved Hide resolved
}

$path = rtrim($path, '/') . '/' . $filename;
$path .= $filename;
if (is_file($path))
{
return $path;
Expand Down