Browse Source

Adjust cache-dir docs, fixes #1667

Jordi Boggiano 11 years ago
parent
commit
565e216afb
2 changed files with 9 additions and 1 deletions
  1. 8 0
      doc/03-cli.md
  2. 1 1
      src/Composer/Factory.php

+ 8 - 0
doc/03-cli.md

@@ -461,6 +461,14 @@ This file allows you to set [configuration](04-schema.md#config) and
 In case global configuration matches _local_ configuration, the _local_
 configuration in the project's `composer.json` always wins.
 
+### COMPOSER_CACHE_DIR
+
+The `COMPOSER_CACHE_DIR` var allows you to change the composer cache directory,
+which is also configurable via the [`cache-dir`](04-schema.md#config) option.
+
+By default it points to $COMPOSER_HOME/cache on \*nix and OSX, and
+`C:\Users\<user>\AppData\Local\Composer` (or `%LOCALAPPDATA%/Composer`) on Windows.
+
 ### COMPOSER_PROCESS_TIMEOUT
 
 This env var controls the time composer waits for commands (such as git

+ 1 - 1
src/Composer/Factory.php

@@ -60,7 +60,7 @@ class Factory
                 if ($cacheDir = getenv('LOCALAPPDATA')) {
                     $cacheDir .= '/Composer';
                 } else {
-                    $cacheDir = getenv('APPDATA') . '/Composer/cache';
+                    $cacheDir = $home . '/cache';
                 }
                 $cacheDir = strtr($cacheDir, '\\', '/');
             } else {