1010namespace Nette \Loaders ;
1111
1212use Nette ;
13+ use Nette \Utils \FileSystem ;
1314use SplFileInfo ;
1415
1516
@@ -248,7 +249,7 @@ private function refreshClasses(): void
248249
249250
250251 /**
251- * Creates an iterator scaning directory for PHP files and subdirectories.
252+ * Creates an iterator scanning directory for PHP files and subdirectories.
252253 * @throws Nette\IOException if path is not found
253254 */
254255 private function createFileIterator (string $ dir ): Nette \Utils \Finder
@@ -258,21 +259,16 @@ private function createFileIterator(string $dir): Nette\Utils\Finder
258259 }
259260
260261 $ dir = realpath ($ dir ) ?: $ dir ; // realpath does not work in phar
261-
262-
263262 $ disallow = [];
264263 foreach (array_merge ($ this ->ignoreDirs , $ this ->excludeDirs ) as $ item ) {
265264 if ($ item = realpath ($ item )) {
266- $ disallow [str_replace ( '\\' , ' / ' , $ item )] = true ;
265+ $ disallow [FileSystem:: unixSlashes ( $ item )] = true ;
267266 }
268267 }
269268
270269 return Nette \Utils \Finder::findFiles ($ this ->acceptFiles )
271- ->filter ($ filter = function (SplFileInfo $ file ) use ($ disallow ) {
272- return $ file ->getRealPath () === false
273- ? true
274- : !isset ($ disallow [str_replace ('\\' , '/ ' , $ file ->getRealPath ())]);
275- })
270+ ->filter ($ filter = fn (SplFileInfo $ file ) => $ file ->getRealPath () === false
271+ || !isset ($ disallow [FileSystem::unixSlashes ($ file ->getRealPath ())]))
276272 ->descentFilter ($ filter )
277273 ->from ($ dir )
278274 ->exclude ($ this ->ignoreDirs );
@@ -408,7 +404,7 @@ public function setAutoRefresh(bool $on = true): static
408404 */
409405 public function setTempDirectory (string $ dir ): static
410406 {
411- Nette \ Utils \ FileSystem::createDir ($ dir );
407+ FileSystem::createDir ($ dir );
412408 $ this ->tempDirectory = $ dir ;
413409 return $ this ;
414410 }
0 commit comments