Skip to content

Commit

Permalink
Use DeleteDir task to clean up after rename in Extract.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-1-anderson committed Apr 13, 2016
1 parent 6408444 commit 9982ede
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Task/Archive/Extract.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Robo\Result;
use Robo\Task\BaseTask;
use Robo\Task\FileSystem\FilesystemStack;
use Robo\Task\FileSystem\DeleteDir;

/**
* Extracts an archive.
Expand Down Expand Up @@ -91,7 +92,7 @@ public function run()
$hasEncapsulatingFolder = ((count($filesInExtractLocation) == 1) && is_dir($filesInExtractLocation[0]));
if ($hasEncapsulatingFolder && !$this->preserveTopDirectory) {
$result = (new FileSystemStack())->rename($filesInExtractLocation[0], $this->to)->run();
@rmdir($extractLocation);
(new DeleteDir($extractLocation))->run();
} else {
$result = (new FileSystemStack())->rename($extractLocation, $this->to)->run();
}
Expand Down

0 comments on commit 9982ede

Please sign in to comment.