Skip to content

Commit df67660

Browse files
committed
Update logic env SCRIPT_PATH
1 parent 50029a7 commit df67660

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Helpers/FileSystem.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
namespace Microwin7\PHPUtils\Helpers;
44

55
use UnexpectedValueException;
6-
use Microwin7\PHPUtils\Utils\Texture;
7-
use Microwin7\PHPUtils\Configs\TextureConfig;
86
use Microwin7\PHPUtils\Exceptions\FileSystemException;
97

108
class FileSystem
@@ -66,7 +64,6 @@ public function is_dir(string &$directory): bool
6664
public function recursiveSearchNameFileCaseInsensitive(string $directory, string $fileName, ?string $extension = null, int $level = -1): string|null
6765
{
6866
$extension ??= '';
69-
empty($extension) ?: ($extension = '.' . $extension);
7067
try {
7168
$directory = preg_replace("/\/+$/", "", $directory);
7269
$iterator = new \RecursiveIteratorIterator(
@@ -104,6 +101,7 @@ public function recursiveSearchNameFileCaseInsensitive(string $directory, string
104101
private function recursiveSearchFiles(string $directory, ?string $extension = null, int $level = -1): array
105102
{
106103
$extension ??= '';
104+
$extension = str_replace('.', '', $extension);
107105
/** @var string[] $filename */
108106
$filename = [];
109107
try {

src/Utils/Path.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static function ROOT_FOLDER(): string
1919
*/
2020
public static function SCRIPT_PATH(): string
2121
{
22-
return ar_slash_string(getenv()['SCRIPT_PATH'] ?? throw new \RuntimeException('NEED SET SCRIPT_PATH ENV'));
22+
return ($ENV = getenv(__FUNCTION__)) === false ? '' : (empty($ENV) ? '' : ar_slash_string($ENV));
2323
}
2424
public static function DB_LOG_FOLDER(): string
2525
{

0 commit comments

Comments
 (0)