Add getPath

This commit is contained in:
Philipp Lang 2022-10-31 14:36:38 +01:00
parent ae4d9f74ef
commit 5a68cce19e
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ namespace Zoomyboy\Tex;
use Illuminate\Contracts\Support\Responsable;
use Illuminate\Http\File;
use Illuminate\Support\Str;
use Log;
abstract class BaseCompiler implements Responsable
{
@ -26,6 +27,7 @@ abstract class BaseCompiler implements Responsable
$this->refreshFile();
if (!$this->file->isFile()) {
Log::error('Compilation failed', ['body' => $contents, 'output' => $output, 'dir' => $this->file->getPath(), 'command' => $this->command($document)]);
throw (new CompilerException('Compilation failed.'))->setOutput($output);
}
@ -40,6 +42,11 @@ abstract class BaseCompiler implements Responsable
]);
}
public function getPath(): string
{
return $this->file->getRealPath();
}
protected function prepareForCompilation(Document $document): void
{
$workDir = '/tmp/'.Str::random(32);