Skip to content

Commit

Permalink
Improve autoloader (when used as a dependency)
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Feb 6, 2019
1 parent b01e95f commit 0d92ad7
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions bin/gt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@ use Gt\Installer\Command\CreateCommand;
use Gt\Installer\Command\RunCommand;
use Gt\Installer\Command\ServeCommand;

require implode(DIRECTORY_SEPARATOR, [
__DIR__,
"..",
"vendor",
"autoload.php",
]);
$autoloadLocations = [
implode(DIRECTORY_SEPARATOR, [
__DIR__,
"..",
"..",
"..",
"autoload.php",
]),
implode(DIRECTORY_SEPARATOR, [
__DIR__,
"..",
"vendor",
"autoload.php",
]),
];

foreach($autoloadLocations as $location) {
if(file_exists($location)) {
require($location);
break;
}
}

$app = new \Gt\Cli\Application(
"PHP.Gt Installer",
Expand Down

0 comments on commit 0d92ad7

Please sign in to comment.