From 1bf06d5acce1d4ea28a64c605beb7dab717d089d Mon Sep 17 00:00:00 2001 From: Sebastian Schreiber Date: Tue, 4 Apr 2023 18:14:14 +0200 Subject: [PATCH] TASK: Use other directory in phar context --- src/Cli/Symfony/ConsoleKernel.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Cli/Symfony/ConsoleKernel.php b/src/Cli/Symfony/ConsoleKernel.php index 8c836f72..391eacab 100644 --- a/src/Cli/Symfony/ConsoleKernel.php +++ b/src/Cli/Symfony/ConsoleKernel.php @@ -11,6 +11,7 @@ namespace TYPO3\Surf\Cli\Symfony; +use Phar; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Symfony\Component\Config\Loader\LoaderInterface; @@ -67,8 +68,21 @@ protected function build(ContainerBuilder $container): void ); } - public function getProjectDir(): string + public function getCacheDir(): string { - return \dirname(__DIR__, 3); + if(Phar::running() !== '') { + return sys_get_temp_dir() . '/_surf'; + } + + return parent::getCacheDir(); + } + + public function getLogDir(): string + { + if(Phar::running() !== '') { + return sys_get_temp_dir() . '/_surf_log'; + } + + return parent::getLogDir(); } }