Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 Ensures absolute paths during detection fase
Browse files Browse the repository at this point in the history
Ref #63
frenck committed Oct 26, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 1efacc8 commit ab1a545
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/Plugin.php
Original file line number Diff line number Diff line change
@@ -72,6 +72,11 @@ class Plugin implements PluginInterface, EventSubscriberInterface
*/
private $filesystem;

/**
* @var string
*/
private $cwd;

/**
* Triggers the plugin's main functionality.
*
@@ -127,6 +132,7 @@ private function init()
$this->installedPaths = array();
$this->processExecutor = new ProcessExecutor($this->io);
$this->filesystem = new Filesystem($this->processExecutor);
$this->cwd = getcwd();
}

/**
@@ -285,10 +291,16 @@ private function updateInstalledPaths()
{
$changes = false;

$searchPaths = array(getcwd());
$searchPaths = array($this->cwd);
$codingStandardPackages = $this->getPHPCodingStandardPackages();
foreach ($codingStandardPackages as $package) {
$searchPaths[] = $this->composer->getInstallationManager()->getInstallPath($package);
$installPath = $this->composer->getInstallationManager()->getInstallPath($package);
if ($this->filesystem->isAbsolutePath($installPath) === false) {
$installPath = $this->filesystem->normalizePath(
$this->cwd . DIRECTORY_SEPARATOR . $installPath
);
}
$searchPaths[] = $installPath;
}

$finder = new Finder();
@@ -408,7 +420,7 @@ private function isPHPCodeSnifferInstalled($versionConstraint = null)
*/
private function isRunningGlobally()
{
return ($this->composer->getConfig()->get('home') === getcwd());
return ($this->composer->getConfig()->get('home') === $this->cwd);
}

/**

0 comments on commit ab1a545

Please sign in to comment.