From ccbb36b5c707824f41096d6565abd12d273f734c Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Mon, 20 Sep 2021 10:37:20 +0200
Subject: [PATCH] composer/plugin/ahoy#3 Use correct vendor directory

---
 src/Handler.php | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Handler.php b/src/Handler.php
index 741b8a6..0472c49 100644
--- a/src/Handler.php
+++ b/src/Handler.php
@@ -40,6 +40,7 @@ class Handler extends BaseHandler {
       ];
     }
 
+    $rootDir = getcwd();
     $installationManager = $this->composer->getInstallationManager();
     foreach ($this->composer->getRepositoryManager()->getLocalRepository()->search('lakedrops/*') as $pkg) {
       $pluginRoot = $installationManager->getInstallPath($this->getPackage($pkg['name']));
@@ -49,13 +50,13 @@ class Handler extends BaseHandler {
           $ahoy['commands'][$command] = $commands;
           if (isset($commands['imports']) && is_array($commands['imports'])) {
             foreach ($commands['imports'] as $key => $import) {
-              $ahoy['commands'][$command]['imports'][$key] = './vendor/' . $pkg['name'] . '/' . $import;
+              $ahoy['commands'][$command]['imports'][$key] = '.' . substr($pluginRoot, strlen($rootDir)) . '/' . $import;
             }
           }
         }
       }
     }
-    $file = getcwd() . '/.ahoy.yml';
+    $file = $rootDir . '/.ahoy.yml';
     file_put_contents($file, $rendered = Yaml::dump($ahoy, 9, 2));
     $this->gitIgnore('.ahoy.yml');
   }
-- 
GitLab