From 8be92dadd23d2a2ee07c81ff7a5c05ec5d9b9e0c Mon Sep 17 00:00:00 2001 From: Lucas Nepomuceno Date: Fri, 19 Jan 2024 12:07:12 -0300 Subject: [PATCH] feat: adds support for system temp dir --- src/Helpers/helpers.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Helpers/helpers.php b/src/Helpers/helpers.php index a3d6dbe..46843e0 100644 --- a/src/Helpers/helpers.php +++ b/src/Helpers/helpers.php @@ -83,7 +83,13 @@ function a1TempDir(bool $tempFile = false, string $fileExt = '.pfx'): string { $tempDir = dirname(__DIR__) . '/Temp/'; - if ($tempFile) $tempDir .= Str::orderedUuid() . $fileExt; + if (!is_writable($tempDir)) { + $tempDir = sys_get_temp_dir(); + } + + if ($tempFile) { + $tempDir .= Str::orderedUuid() . $fileExt; + } return $tempDir; }