From c32df6e54343f4612e5d966de6296c471251678d Mon Sep 17 00:00:00 2001 From: Ken Love Date: Tue, 11 Aug 2015 22:30:50 -0400 Subject: [PATCH] Create sub-directory for temp storage --- src/PatternLab/Fetch.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/PatternLab/Fetch.php b/src/PatternLab/Fetch.php index 6dc10a34..4bc6ceaf 100644 --- a/src/PatternLab/Fetch.php +++ b/src/PatternLab/Fetch.php @@ -57,7 +57,7 @@ public function fetchStarterKit($starterkit = "") { // set default attributes $sourceDir = Config::getOption("sourceDir"); - $tempDir = sys_get_temp_dir(); + $tempDir = sys_get_temp_dir().DIRECTORY_SEPARATOR."pl-sk"; $tempDirSK = $tempDir.DIRECTORY_SEPARATOR."pl-sk-archive"; $tempDirDist = $tempDirSK.DIRECTORY_SEPARATOR."dist"; $tempComposerFile = $tempDirSK.DIRECTORY_SEPARATOR."composer.json"; @@ -75,6 +75,14 @@ public function fetchStarterKit($starterkit = "") { $error = error_get_last(); Console::writeError("the starterkit wasn't downloaded because:\n\n ".$error["message"]); } + + // Create temp directory if doesn't exist + $fs = new Filesystem(); + try { + $fs->mkdir($tempDir, 0775); + } catch (IOExceptionInterface $e) { + Console::writeError("Error creating temporary directory at " . $e->getPath()); + } // write the package to the temp directory $tempFile = tempnam($tempDir, "pl-sk-archive.tar.gz");