1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 20:35:23 +01:00

swoole协程状态下无法读取目录 判断是否有指定路径 没有就使用当前目录

This commit is contained in:
953446 2024-10-11 22:45:51 +07:00
parent 72cb247499
commit eaa4883684

View File

@ -235,7 +235,8 @@ final class Magic
self::$isIpcWorker = \defined('MADELINE_WORKER_TYPE') ? MADELINE_WORKER_TYPE === 'madeline-ipc' : false;
// Important, obtain root relative to caller script
$backtrace = debug_backtrace(0);
self::$script_cwd = self::$cwd = \dirname(end($backtrace)['file']);
$lastTrace = end($backtrace);
self::$script_cwd = self::$cwd = isset($lastTrace['file']) ? \dirname($lastTrace['file']) : getcwd();
if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
try {
error_reporting(E_ALL);