From bc54dd93e2f7f40f9208520eff983a29a1480464 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 26 Feb 2023 19:09:22 +0100 Subject: [PATCH] Fix loading autoload.php file in CLI eesyphp tool --- eesyphp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/eesyphp b/eesyphp index 5d18956..bc7269f 100755 --- a/eesyphp +++ b/eesyphp @@ -4,6 +4,16 @@ use EesyPHP\App; use EesyPHP\Cli; -require __DIR__."/vendor/autoload.php"; +if (isset($_composer_autoload_path)) + require $_composer_autoload_path; +else if (file_exists(__DIR__ . '/../../autoload.php')) + require __DIR__ . '/../../autoload.php'; +else if (file_exists(__DIR__ . '/../vendor/autoload.php')) + require __DIR__ . '/../vendor/autoload.php'; +else if (file_exists(__DIR__."/vendor/autoload.php")) + require __DIR__."/vendor/autoload.php"; +else + die("Fail to find composer vendor/autoload.php file\n"); + App::init(null, null, __DIR__); Cli :: handle_args();