From 735b9b0a0f8f1eab47c5001d95e7b16f273e0430 Mon Sep 17 00:00:00 2001 From: Mattias Michaux Date: Thu, 11 May 2023 01:12:16 +0200 Subject: [PATCH] determine the vendor root dir based on the composer classloader (#499) * determine the vendor root dir based on the composer classloader * styleci fixes --- src/Command/ElFinderInstallerCommand.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Command/ElFinderInstallerCommand.php b/src/Command/ElFinderInstallerCommand.php index 8612189..9369f64 100644 --- a/src/Command/ElFinderInstallerCommand.php +++ b/src/Command/ElFinderInstallerCommand.php @@ -47,7 +47,7 @@ protected function configure(): void Where to install elfinder php %command.full_name% --docroot=public_html EOF - ); + ); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -61,12 +61,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int $publicDir = sprintf('%s/%s/bundles/fmelfinder', $rootDir, $dr); + $reflection = new \ReflectionClass(\Composer\Autoload\ClassLoader::class); + $vendorRootDir = dirname($reflection->getFileName(), 3); + $io->note(sprintf('Starting to install elfinder to %s folder', $publicDir)); - $this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_CSS_DIR, $publicDir.'/css'); - $this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_IMG_DIR, $publicDir.'/img'); - $this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_JS_DIR, $publicDir.'/js'); - $this->fileSystem->mirror($rootDir.'/'.self::ELFINDER_SOUNDS_DIR, $publicDir.'/sounds'); + $this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_CSS_DIR, $publicDir.'/css'); + $this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_IMG_DIR, $publicDir.'/img'); + $this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_JS_DIR, $publicDir.'/js'); + $this->fileSystem->mirror($vendorRootDir.'/'.self::ELFINDER_SOUNDS_DIR, $publicDir.'/sounds'); $io->success('elFinder assets successfully installed');