protected function resolvePaths($basePath)
{
// determine configuration path and file
if (empty($basePath) || ($basePath = realpath($basePath)) === false) {
throw new TConfigurationException('application_basepath_invalid', $basePath);
}
if (is_dir($basePath) && is_file($basePath . DIRECTORY_SEPARATOR . $this->getConfigurationFileName())) {
$configFile = $basePath . DIRECTORY_SEPARATOR . $this->getConfigurationFileName();
} else {
if (is_file($basePath)) {
$configFile = $basePath;
$basePath = dirname($configFile);
} else {
$configFile = null;
}
}
// determine runtime path
$runtimePath = $basePath . DIRECTORY_SEPARATOR . self::RUNTIME_PATH;
if (is_writable($runtimePath)) {
if ($configFile !== null) {
$runtimePath .= DIRECTORY_SEPARATOR . basename($configFile) . '-' . Prado::getVersion();
if (!is_dir($runtimePath)) {
if (@mkdir($runtimePath) === false) {
throw new TConfigurationException('application_runtimepath_failed', $runtimePath);
}
@chmod($runtimePath, PRADO_CHMOD);
//make it deletable
}
$this->setConfigurationFile($configFile);
}
$this->setBasePath($basePath);
$this->setRuntimePath($runtimePath);
} else {
throw new TConfigurationException('application_runtimepath_invalid', $runtimePath);
}
}