Update cache dir on macOS to follow OS guidelines (now $HOME/Library/Caches/Composer) (#9898)
Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>pull/9928/head
parent
dd625669e8
commit
759897e7e8
|
@ -213,9 +213,10 @@ versions. See also [COMPOSER_HOME](03-cli.md#composer-home).
|
||||||
## cache-dir
|
## cache-dir
|
||||||
|
|
||||||
Defaults to `C:\Users\<user>\AppData\Local\Composer` on Windows,
|
Defaults to `C:\Users\<user>\AppData\Local\Composer` on Windows,
|
||||||
`$XDG_CACHE_HOME/composer` on unix systems that follow the XDG Base Directory
|
`/Users/<user>/Library/Caches/composer` on macOS, `$XDG_CACHE_HOME/composer`
|
||||||
Specifications, and `$home/cache` on other unix systems. Stores all the caches
|
on unix systems that follow the XDG Base Directory Specifications, and
|
||||||
used by Composer. See also [COMPOSER_HOME](03-cli.md#composer-home).
|
`$home/cache` on other unix systems. Stores all the caches used by Composer.
|
||||||
|
See also [COMPOSER_HOME](03-cli.md#composer-home).
|
||||||
|
|
||||||
## cache-files-dir
|
## cache-files-dir
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,15 @@ class Factory
|
||||||
}
|
}
|
||||||
|
|
||||||
$userDir = self::getUserDir();
|
$userDir = self::getUserDir();
|
||||||
|
if (PHP_OS === 'Darwin') {
|
||||||
|
// Migrate existing cache dir in old location if present
|
||||||
|
if (is_dir($home . '/cache') && !is_dir($userDir . '/Library/Caches/composer')) {
|
||||||
|
Silencer::call('rename', $home . '/cache', $userDir . '/Library/Caches/composer');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $userDir . '/Library/Caches/composer';
|
||||||
|
}
|
||||||
|
|
||||||
if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
|
if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
|
||||||
return $home . '/cache';
|
return $home . '/cache';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue