Permalink
Browse files

* move working directory related to BaseDumper

  • Loading branch information...
1 parent 176cd58 commit 806c2eb08f6be5e7884efaa86d7bfa87e69881eb @till committed Jun 15, 2012
Showing with 13 additions and 4 deletions.
  1. +12 −0 src/Composer/Package/Dumper/BaseDumper.php
  2. +1 −4 src/Composer/Package/Dumper/ZipDumper.php
@@ -113,6 +113,18 @@ protected function downloadGit(PackageInterface $package, $workDir)
$downloader->download($package, $workDir);
}
+ protected function getAndEnsureWorkDirectory(PackageInterface $package)
+ {
+ $workDir = sprintf('%s/%s/%s', $this->temp, $this->format, $package->getName());
+ if (!file_exists($workDir)) {
+ mkdir($workDir, 0777, true);
+ }
+ if (!file_exists($workDir)) {
+ throw new \RuntimeException("Could not find '{$workDir}' directory.");
+ }
+ return $workDir;
+ }
+
/**
* @param string $fileName
* @param string $sourceRef
@@ -25,10 +25,7 @@ class ZipDumper extends BaseDumper implements DumperInterface
public function dump(PackageInterface $package)
{
- $workDir = sprintf('%s/zip/%s', $this->temp, $package->getName());
- if (!file_exists($workDir)) {
- mkdir($workDir, 0777, true);
- }
+ $workDir = $this->getAndEnsureWorkDirectory($package);
$fileName = $this->getFilename($package, 'zip');
$sourceType = $package->getSourceType();

0 comments on commit 806c2eb

Please sign in to comment.