/** * Find the relative bin directory * * @return string */ public function getBinDir() { $binDir = $this->config->getBinDir(); if (!$this->fileSystem->exists($binDir)) { throw new RuntimeException('The configured BIN directory could not be found.'); } return $this->getRelativePath($binDir); }
/** * Make a guess to the bin dir * * @return string */ protected function guessBinDir() { $defaultBinDir = $this->config->getBinDir(); if (!$this->composer()->hasConfiguration()) { return $defaultBinDir; } $config = $this->composer()->getConfiguration(); if (!$config->has('bin-dir')) { return $defaultBinDir; } return $config->get('bin-dir', Config::RELATIVE_PATHS); }
/** * Make a guess to the bin dir * * @return string */ protected function guessBinDir() { $defaultBinDir = $this->config->getBinDir(); $composerFile = 'composer.json'; if (!$this->filesystem->exists($composerFile)) { return $defaultBinDir; } $composer = json_decode(file_get_contents('composer.json'), true); if (isset($composer['config']['bin-dir'])) { return $composer['config']['bin-dir']; } return $defaultBinDir; }