Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* a little more "windows robust" when looking for package.xml
  • Loading branch information
stigsb committed Nov 26, 2002
1 parent ad2618b commit 6932042
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pear/PEAR/Common.php
Expand Up @@ -696,26 +696,28 @@ function _pkginfo_cdata_1_0($xp, $data)
function infoFromTgzFile($file)
{
if (!@is_file($file)) {
return $this->raiseError("tgz :: could not open file \"$file\"");
return $this->raiseError("could not open file \"$file\"");
}
$tar = new Archive_Tar($file);
$content = $tar->listContent();
if (!is_array($content)) {
return $this->raiseError("tgz :: could not get contents of package \"$file\"");
return $this->raiseError("could not get contents of package \"$file\"");
}
$xml = null;
foreach ($content as $file) {
$name = $file['filename'];
if ($name == 'package.xml') {
$xml = $name;
} elseif (ereg('^.*/package.xml$', $name, $match)) {
break;
} elseif (ereg('package.xml$', $name, $match)) {
$xml = $match[0];
break;
}
}
$tmpdir = System::mkTemp('-d pear');
$this->addTempFile($tmpdir);
if (!$xml || !$tar->extractList($xml, $tmpdir)) {
return $this->raiseError('tgz :: could not extract the package.xml file');
return $this->raiseError('could not extract the package.xml file');
}
return $this->infoFromDescriptionFile("$tmpdir/$xml");
}
Expand Down

0 comments on commit 6932042

Please sign in to comment.