1
0
Fork 0

Use COMPOSER_HOME if defined instead of falling back to HOME, fixes #4789

pull/3177/head
Jordi Boggiano 2016-01-19 10:54:14 +00:00
parent 96ff17c520
commit 40baa3ff05
1 changed files with 10 additions and 0 deletions

View File

@ -84,6 +84,11 @@ class Factory
return $cacheDir; return $cacheDir;
} }
$homeEnv = getenv('COMPOSER_HOME');
if ($homeEnv) {
return $homeEnv . '/cache';
}
if (defined('PHP_WINDOWS_VERSION_MAJOR')) { if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
if ($cacheDir = getenv('LOCALAPPDATA')) { if ($cacheDir = getenv('LOCALAPPDATA')) {
$cacheDir .= '/Composer'; $cacheDir .= '/Composer';
@ -114,6 +119,11 @@ class Factory
*/ */
protected static function getDataDir($home) protected static function getDataDir($home)
{ {
$homeEnv = getenv('COMPOSER_HOME');
if ($homeEnv) {
return $homeEnv;
}
if (defined('PHP_WINDOWS_VERSION_MAJOR')) { if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
return strtr($home, '\\', '/'); return strtr($home, '\\', '/');
} }