Browse Source

Create ~/.composer/cache.hg directory if not exists

Jerome Tamarelle 13 years ago
parent
commit
8b408449f6
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/Composer/Repository/Vcs/HgDriver.php

+ 5 - 1
src/Composer/Repository/Vcs/HgDriver.php

@@ -36,7 +36,11 @@ class HgDriver extends VcsDriver
         if (is_dir($this->tmpDir)) {
             $this->process->execute(sprintf('cd %s && hg pull -u', escapeshellarg($this->tmpDir)), $output);
         } else {
-            $this->process->execute(sprintf('cd %s && hg clone %s %s', escapeshellarg(dirname($this->tmpDir)), escapeshellarg($this->url), escapeshellarg($this->tmpDir)), $output);
+            $dir = dirname($this->tmpDir);
+            if (!is_dir($dir)) {
+                mkdir($dir, 0777 & ~umask(), true);
+            }
+            $this->process->execute(sprintf('cd %s && hg clone %s %s', escapeshellarg($dir), escapeshellarg($this->url), escapeshellarg($this->tmpDir)), $output);
         }
 
         $this->getTags();