From d15fc144633c2fed75fca348d8402f656e28efce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=94=81?= <52o@qq52o.cn> Date: Wed, 20 Jul 2022 00:20:25 +0800 Subject: [PATCH] Fix use SQLite error of windows install (#1471) --- install.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 7b3b5e46..c1786f77 100644 --- a/install.php +++ b/install.php @@ -1022,7 +1022,12 @@ function install_step_2_perform() $error = (new \Typecho\Validate()) ->addRule('dbFile', 'required', _t('确认您的配置')) ->addRule('dbFile', function (string $path) { - return !!preg_match("/^(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i", $path); + $pattern = "/^(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i"; + if (strstr(PHP_OS, 'WIN')) + { + $pattern = "/(\/[._a-z0-9-]+)*[a-z0-9]+\.[a-z0-9]{2,}$/i"; + } + return !!preg_match($pattern, $path); }, _t('确认您的配置')) ->run($config); break;