Skip to content

Commit

Permalink
Closes #262
Browse files Browse the repository at this point in the history
  • Loading branch information
theseer committed Jun 2, 2020
1 parent 97b5904 commit 77f9b88
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/shared/PharRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use DOMElement;
use PharIo\FileSystem\Directory;
use PharIo\FileSystem\DirectoryException;
use PharIo\FileSystem\File;
use PharIo\FileSystem\Filename;
use PharIo\Version\Version;
Expand Down Expand Up @@ -205,6 +206,16 @@ private function savePhar(Phar $phar): Filename {
$destination = new Filename($this->getPharDestination($phar));

$targetDir = $destination->getDirectory();
try {
$targetDir->ensureExists();
} catch (DirectoryException $e) {
throw new FileNotWritableException(
\sprintf("Cannot write phar to %s:\n%s",
$targetDir->asString(),
$e->getMessage()
)
);
}

if (!$targetDir->isWritable()) {
throw new FileNotWritableException(
Expand Down

0 comments on commit 77f9b88

Please sign in to comment.