Fixed failure when running from within phar

This commit is contained in:
Chris 2017-01-10 17:11:23 +01:00
parent 70c510ff9b
commit 213997b0d0
2 changed files with 4 additions and 4 deletions

View File

@ -211,10 +211,10 @@ class Manifest
$it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source->path)); $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source->path));
foreach ($it as $item) { foreach ($it as $item) {
if ($item->isDir()) continue; if ($item->isDir()) continue;
$items[] = (object)['src'=>$item->getPathname(),'dest'=>null]; $items[] = (object)['src'=>realpath($item->getPathname()),'dest'=>$item->getPathname()];
} }
} elseif ($source->type == 'file') { } elseif ($source->type == 'file') {
$items[] = (object)['src'=>$source->path,'dest'=>null]; $items[] = (object)['src'=>realpath($source->path),'dest'=>$item->getPathname()];
} else { } else {
log_warn("Unsupported source type: %s", $source->type); log_warn("Unsupported source type: %s", $source->type);
} }

View File

@ -52,7 +52,7 @@ class PharBuilder
$size_tot = 0; $size_min = 0; $size_tot = 0; $size_min = 0;
foreach ($this->files as $file) { foreach ($this->files as $file) {
$i++; $i++;
$tp = dirname($file->src); $tp = dirname($file->dest);
if (($tp!=$lp) && (IS_TTY)) { if (($tp!=$lp) && (IS_TTY)) {
$lp=$tp; $lp=$tp;
printf("\r\e[K%d/%d %s", $i, $t, $tp); printf("\r\e[K%d/%d %s", $i, $t, $tp);
@ -66,7 +66,7 @@ class PharBuilder
} else { } else {
$size_tot += filesize($file->src); $size_tot += filesize($file->src);
$size_min += filesize($file->src); $size_min += filesize($file->src);
$phar->addFile($file->dest?:$file->src, $file->src); $phar->addFile($file->src, $file->dest);
} }
} }
(IS_TTY) && printf("\r\e[K"); (IS_TTY) && printf("\r\e[K");