protected function configureCacheDirectory()
{
$cacheDirectory = $this->cacheDirectory;
if ($cacheDirectory === '') {
$codeOrData = $this->cache instanceof PhpFrontend ? 'Code' : 'Data';
$baseDirectory = $this->baseDirectory ?: $this->environmentConfiguration->getFileCacheBasePath();
$cacheDirectory = $baseDirectory . 'Cache/' . $codeOrData . '/' . $this->cacheIdentifier . '/';
}
if (!is_writable($cacheDirectory)) {
try {
Files::createDirectoryRecursively($cacheDirectory);
} catch (FilesException $exception) {
throw new Exception('The cache directory "' . $cacheDirectory . '" could not be created.', 1264426237);
}
}
if (!is_dir($cacheDirectory) && !is_link($cacheDirectory)) {
throw new Exception('The cache directory "' . $cacheDirectory . '" does not exist.', 1203965199);
}
if (!is_writable($cacheDirectory)) {
throw new Exception('The cache directory "' . $cacheDirectory . '" is not writable.', 1203965200);
}
$this->cacheDirectory = $cacheDirectory;
}