10
10
namespace Nette \Loaders ;
11
11
12
12
use Nette ;
13
+ use Nette \Utils \FileSystem ;
13
14
use SplFileInfo ;
14
15
15
16
@@ -248,7 +249,7 @@ private function refreshClasses(): void
248
249
249
250
250
251
/**
251
- * Creates an iterator scaning directory for PHP files and subdirectories.
252
+ * Creates an iterator scanning directory for PHP files and subdirectories.
252
253
* @throws Nette\IOException if path is not found
253
254
*/
254
255
private function createFileIterator (string $ dir ): Nette \Utils \Finder
@@ -258,21 +259,16 @@ private function createFileIterator(string $dir): Nette\Utils\Finder
258
259
}
259
260
260
261
$ dir = realpath ($ dir ) ?: $ dir ; // realpath does not work in phar
261
-
262
-
263
262
$ disallow = [];
264
263
foreach (array_merge ($ this ->ignoreDirs , $ this ->excludeDirs ) as $ item ) {
265
264
if ($ item = realpath ($ item )) {
266
- $ disallow [str_replace ( '\\' , ' / ' , $ item )] = true ;
265
+ $ disallow [FileSystem:: unixSlashes ( $ item )] = true ;
267
266
}
268
267
}
269
268
270
269
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 ())]))
276
272
->descentFilter ($ filter )
277
273
->from ($ dir )
278
274
->exclude ($ this ->ignoreDirs );
@@ -408,7 +404,7 @@ public function setAutoRefresh(bool $on = true): static
408
404
*/
409
405
public function setTempDirectory (string $ dir ): static
410
406
{
411
- Nette \ Utils \ FileSystem::createDir ($ dir );
407
+ FileSystem::createDir ($ dir );
412
408
$ this ->tempDirectory = $ dir ;
413
409
return $ this ;
414
410
}
0 commit comments