mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Add error handling for missing vswhere.exe in WindowsUtil
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace StaticPHP\Util\System;
|
||||
|
||||
use StaticPHP\Exception\EnvironmentException;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
class WindowsUtil
|
||||
@@ -47,6 +48,10 @@ class WindowsUtil
|
||||
|
||||
// call vswhere (need VS and C++ tools installed), output is json
|
||||
$vswhere_exec = PKG_ROOT_PATH . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'vswhere.exe';
|
||||
// detect vswhere exists, if not throw error
|
||||
if (!file_exists($vswhere_exec)) {
|
||||
throw new EnvironmentException('vswhere.exe not found, please run `doctor` command first');
|
||||
}
|
||||
$args = [
|
||||
'-latest',
|
||||
'-format', 'json',
|
||||
|
||||
Reference in New Issue
Block a user