Skip to content

Commit 6932042

Browse files
committed
* a little more "windows robust" when looking for package.xml
1 parent ad2618b commit 6932042

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pear/PEAR/Common.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -696,26 +696,28 @@ function _pkginfo_cdata_1_0($xp, $data)
696696
function infoFromTgzFile($file)
697697
{
698698
if (!@is_file($file)) {
699-
return $this->raiseError("tgz :: could not open file \"$file\"");
699+
return $this->raiseError("could not open file \"$file\"");
700700
}
701701
$tar = new Archive_Tar($file);
702702
$content = $tar->listContent();
703703
if (!is_array($content)) {
704-
return $this->raiseError("tgz :: could not get contents of package \"$file\"");
704+
return $this->raiseError("could not get contents of package \"$file\"");
705705
}
706706
$xml = null;
707707
foreach ($content as $file) {
708708
$name = $file['filename'];
709709
if ($name == 'package.xml') {
710710
$xml = $name;
711-
} elseif (ereg('^.*/package.xml$', $name, $match)) {
711+
break;
712+
} elseif (ereg('package.xml$', $name, $match)) {
712713
$xml = $match[0];
714+
break;
713715
}
714716
}
715717
$tmpdir = System::mkTemp('-d pear');
716718
$this->addTempFile($tmpdir);
717719
if (!$xml || !$tar->extractList($xml, $tmpdir)) {
718-
return $this->raiseError('tgz :: could not extract the package.xml file');
720+
return $this->raiseError('could not extract the package.xml file');
719721
}
720722
return $this->infoFromDescriptionFile("$tmpdir/$xml");
721723
}

0 commit comments

Comments
 (0)