mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Use absolute cache directory paths everywhere ref #63
This commit is contained in:
parent
98454f8644
commit
69e185eb17
@ -245,7 +245,23 @@ class Config
|
||||
}
|
||||
|
||||
if (isset($config_xml['cacheDirectory'])) {
|
||||
$config->cache_directory = (string) $config_xml['cacheDirectory'];
|
||||
$path = (string)$config_xml['cacheDirectory'];
|
||||
|
||||
if ($path[0] !== '/') {
|
||||
if (realpath(dirname($path)) !== dirname($path)) {
|
||||
$cache_base_dir = realpath(dirname($config->base_dir . $path));
|
||||
|
||||
if (!$cache_base_dir) {
|
||||
die('Could not locate cache parent directory ' . dirname($config->base_dir . $path) . PHP_EOL);
|
||||
}
|
||||
|
||||
$path = $cache_base_dir . DIRECTORY_SEPARATOR . basename($path);
|
||||
}
|
||||
} elseif (realpath(dirname($path)) === false) {
|
||||
die('Could not locate cache parent directory ' . dirname($path) . PHP_EOL);
|
||||
}
|
||||
|
||||
$config->cache_directory = $path;
|
||||
} else {
|
||||
$config->cache_directory = sys_get_temp_dir() . '/psalm';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user