Skip to content

Commit

Permalink
Fixed issue where getInstallPath can return a relative path in rare c…
Browse files Browse the repository at this point in the history
…ases.
  • Loading branch information
mad-briller authored and ondrejmirtes committed Oct 17, 2022
1 parent 673018e commit f06dbb0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use function dirname;
use function file_exists;
use function file_put_contents;
use function getcwd;
use function in_array;
use function is_file;
use function ksort;
Expand All @@ -21,6 +22,7 @@
use function sprintf;
use function strpos;
use function var_export;
use const DIRECTORY_SEPARATOR;

final class Plugin implements PluginInterface, EventSubscriberInterface
{
Expand Down Expand Up @@ -116,7 +118,13 @@ public function process(Event $event): void
}
continue;
}
$absoluteInstallPath = $installationManager->getInstallPath($package);

$installPath = $installationManager->getInstallPath($package);

$absoluteInstallPath = $fs->isAbsolutePath($installPath)
? $installPath
: getcwd() . DIRECTORY_SEPARATOR . $installPath;

$data[$package->getName()] = [
'install_path' => $absoluteInstallPath,
'relative_install_path' => $fs->findShortestPath(dirname($generatedConfigFilePath), $absoluteInstallPath, true),
Expand Down

0 comments on commit f06dbb0

Please sign in to comment.