/**
* Method to do any prechecks and setup the install paths for the extension
*
* @return void
*
* @since 3.4
* @throws \RuntimeException
*/
protected function setupInstallPaths()
{
// Get the target application
$cname = (string) $this->getManifest()->attributes()->client;
if ($cname) {
// Attempt to map the client to a base path
$client = ApplicationHelper::getClientInfo($cname, true);
if ($client === false) {
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_MOD_UNKNOWN_CLIENT', Text::_('JLIB_INSTALLER_' . $this->route), $client->name));
}
$basePath = $client->path;
$this->clientId = $client->id;
} else {
// No client attribute was found so we assume the site as the client
$basePath = JPATH_SITE;
$this->clientId = 0;
}
// Set the installation path
if (empty($this->element)) {
throw new \RuntimeException(Text::sprintf('JLIB_INSTALLER_ABORT_MOD_INSTALL_NOFILE', Text::_('JLIB_INSTALLER_' . $this->route)));
}
$this->parent->setPath('extension_root', $basePath . '/modules/' . $this->element);
}