function BinaryInstaller::removeBinaries
File
-
vendor/
composer/ composer/ src/ Composer/ Installer/ BinaryInstaller.php, line 110
Class
- BinaryInstaller
- Utility to handle installation of package "bin"/binaries
Namespace
Composer\InstallerCode
public function removeBinaries(PackageInterface $package) : void {
$this->initializeBinDir();
$binaries = $this->getBinaries($package);
if (!$binaries) {
return;
}
foreach ($binaries as $bin) {
$link = $this->binDir . '/' . basename($bin);
if (is_link($link) || file_exists($link)) {
// still checking for symlinks here for legacy support
$this->filesystem
->unlink($link);
}
if (is_file($link . '.bat')) {
$this->filesystem
->unlink($link . '.bat');
}
}
// attempt removing the bin dir in case it is left empty
if (is_dir($this->binDir) && $this->filesystem
->isDirEmpty($this->binDir)) {
Silencer::call('rmdir', $this->binDir);
}
}