2 namespace Drush\Config;
4 use Consolidation\Config\Util\ConfigOverlay;
5 use Symfony\Component\Filesystem\Exception\IOException;
6 use Symfony\Component\Filesystem\Filesystem;
7 use Webmozart\PathUtil\Path;
10 * Accessors for common Drush config keys.
12 class DrushConfig extends ConfigOverlay
16 return $this->get('env.cwd');
19 public function home()
21 return $this->get('env.home');
24 public function user()
26 return $this->get('env.user');
29 public function isWindows()
31 return $this->get('env.is-windows');
36 return $this->get('env.tmp');
39 public function cache()
42 Path::join($this->home(), '.drush/cache'),
43 Path::join($this->tmp(), 'drush-' . $this->user() . '/cache'),
46 $fs = new Filesystem();
47 foreach ($candidates as $candidate) {
49 $fs->mkdir($candidate);
51 } catch (IOException $ioException) {
52 // Do nothing. Jump to the next candidate.
55 throw new \Exception('Cannot create the Drush cache directory. Tried next candidates: ' . implode(', ', $candidates));