From 74cbfb8b73946d080b25613e03aecc4fb2903409 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 1 Feb 2023 16:27:05 +0800 Subject: [PATCH] let build command support windows --- src/ZM/Command/BuildCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ZM/Command/BuildCommand.php b/src/ZM/Command/BuildCommand.php index c296d39f..8bda4150 100644 --- a/src/ZM/Command/BuildCommand.php +++ b/src/ZM/Command/BuildCommand.php @@ -89,9 +89,10 @@ class BuildCommand extends Command $phar->startBuffering(); $files = FileSystem::scanDirFiles(SOURCE_ROOT_DIR, true, true); + $separator = '\\' . DIRECTORY_SEPARATOR; // 只打包 bin / config / resources / src / vendor 目录以及 composer.json / composer.lock / entry.php - $files = array_filter($files, function ($file) { - return preg_match('/(^(bin|config|resources|src|vendor)\\/|^(composer\\.json|README\\.md)$)/', $file); + $files = array_filter($files, function ($file) use ($separator) { + return preg_match('/^(bin|config|resources|src|vendor)' . $separator . '|^(composer\\.json|README\\.md)$/', $file); }); sort($files);