From 2636ca17d98dc0e1edb9bd3552866556ffd2f004 Mon Sep 17 00:00:00 2001 From: Brian Henry Date: Wed, 1 Sep 2021 01:14:05 -0700 Subject: [PATCH] Always use `/` in classmap and files autoloader paths #30 --- src/Autoload.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Autoload.php b/src/Autoload.php index cff901e0..01a1f58d 100644 --- a/src/Autoload.php +++ b/src/Autoload.php @@ -109,6 +109,8 @@ function (&$filepath, $_class) use ($dir, $dirname) { echo "\${$dirname} = dirname(__FILE__);\n\n"; echo "return array(\n"; foreach ($dirMap as $class => $file) { + // Always use `/` in paths. + $file = str_replace(DIRECTORY_SEPARATOR, '/', $file); echo " '{$class}' => {$file},\n"; } echo ");"; @@ -150,6 +152,8 @@ protected function generateFilesAutoloader() if (!isset($filePathinfo['extension']) || 'php' !== $filePathinfo['extension']) { continue; } + // Always use `/` in paths. + $filepath = str_replace(DIRECTORY_SEPARATOR, '/', $filepath); echo "require_once __DIR__ . '{$filepath}';\n"; } }