Closed milo closed 6 years ago
In Nette application bootstrap, I call:
$configurator->createRobotLoader() ->addDirectory(__DIR__) ->addDirectory(__DIR__ . '/../lib') ->excludeDirectory(__DIR__ . '/../lib/tcpdf') ->register();
but exclusion does not work because on line https://github.com/nette/robot-loader/blob/c3b0c97c04ed82f4d1037a0fd0881f94f9588009/src/RobotLoader/RobotLoader.php#L231 leads to
$disallow === [ "D:/Web/project/lib/tcpdf" => true, ]; $path === "D:/Web/project/app/../lib/tcpdf";
I have two solutions in my mind: 1) Convert path to realpath in addDirectory() and: a) ignore missing paths b) throw an exception on missing paths (BC break probability) 2) Modify mentioned line from $dir->getPathname() to $dir->getRealPath().
addDirectory()
$dir->getPathname()
$dir->getRealPath()
Which fix would you prefer? Another one?
getRealPath() seems best, because is called only when refreshing cache, right?
I think so, good point. I'll open PR.
Description
In Nette application bootstrap, I call:
but exclusion does not work because on line https://github.com/nette/robot-loader/blob/c3b0c97c04ed82f4d1037a0fd0881f94f9588009/src/RobotLoader/RobotLoader.php#L231 leads to
I have two solutions in my mind: 1) Convert path to realpath in
addDirectory()
and: a) ignore missing paths b) throw an exception on missing paths (BC break probability) 2) Modify mentioned line from$dir->getPathname()
to$dir->getRealPath()
.Which fix would you prefer? Another one?