1
0
Fork 0

Avoid leftovers in temp dir

pull/3527/head
Jordi Boggiano 2014-12-09 11:32:02 +00:00
parent 3ff8bcffea
commit 10401d544b
1 changed files with 3 additions and 2 deletions

View File

@ -137,7 +137,7 @@ class ArchiveManager
$sourcePath = realpath('.'); $sourcePath = realpath('.');
} else { } else {
// Directory used to download the sources // Directory used to download the sources
$sourcePath = sys_get_temp_dir().'/composer_archiver/arch'.uniqid(); $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
$filesystem->ensureDirectoryExists($sourcePath); $filesystem->ensureDirectoryExists($sourcePath);
// Download sources // Download sources
@ -154,7 +154,7 @@ class ArchiveManager
} }
// Create the archive // Create the archive
$tempTarget = sys_get_temp_dir().'/composer_archiver/arch'.uniqid().'.'.$format; $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
$filesystem->ensureDirectoryExists(dirname($tempTarget)); $filesystem->ensureDirectoryExists(dirname($tempTarget));
$archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes()); $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes());
@ -164,6 +164,7 @@ class ArchiveManager
if (!$package instanceof RootPackageInterface) { if (!$package instanceof RootPackageInterface) {
$filesystem->removeDirectory($sourcePath); $filesystem->removeDirectory($sourcePath);
} }
$filesystem->remove($tempTarget);
return $target; return $target;
} }