mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
cd fix [skip ci]
This commit is contained in:
parent
ea2be1aa19
commit
31f6fb17bf
@ -1,24 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SPC\builder\windows;
|
declare(strict_types=1);
|
||||||
|
|
||||||
class SystemUtil
|
namespace SPC\builder\windows;
|
||||||
{
|
|
||||||
/**
|
class SystemUtil
|
||||||
* @param string $name 命令名称
|
{
|
||||||
* @param array $paths 寻找的目标路径(如果不传入,则使用环境变量 PATH)
|
/**
|
||||||
* @return null|string 找到了返回命令路径,找不到返回 null
|
* @param string $name 命令名称
|
||||||
*/
|
* @param array $paths 寻找的目标路径(如果不传入,则使用环境变量 PATH)
|
||||||
public static function findCommand(string $name, array $paths = []): ?string
|
* @return null|string 找到了返回命令路径,找不到返回 null
|
||||||
{
|
*/
|
||||||
if (!$paths) {
|
public static function findCommand(string $name, array $paths = []): ?string
|
||||||
$paths = explode(PATH_SEPARATOR, getenv('Path'));
|
{
|
||||||
}
|
if (!$paths) {
|
||||||
foreach ($paths as $path) {
|
$paths = explode(PATH_SEPARATOR, getenv('Path'));
|
||||||
if (file_exists($path . DIRECTORY_SEPARATOR . $name)) {
|
}
|
||||||
return $path . DIRECTORY_SEPARATOR . $name;
|
foreach ($paths as $path) {
|
||||||
}
|
if (file_exists($path . DIRECTORY_SEPARATOR . $name)) {
|
||||||
}
|
return $path . DIRECTORY_SEPARATOR . $name;
|
||||||
return null;
|
}
|
||||||
}
|
}
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -30,7 +30,6 @@ class WindowsToolCheckList
|
|||||||
return CheckResult::ok(PHP_SDK_PATH);
|
return CheckResult::ok(PHP_SDK_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[AsFixItem('install-php-sdk')]
|
#[AsFixItem('install-php-sdk')]
|
||||||
public function installPhpSdk(): bool
|
public function installPhpSdk(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class WindowsCmd
|
|||||||
public function execWithEnv(string $cmd): WindowsCmd
|
public function execWithEnv(string $cmd): WindowsCmd
|
||||||
{
|
{
|
||||||
if ($this->getEnvString() !== '') {
|
if ($this->getEnvString() !== '') {
|
||||||
return $this->exec($this->getEnvString() . "call $cmd");
|
return $this->exec($this->getEnvString() . "call {$cmd}");
|
||||||
}
|
}
|
||||||
return $this->exec($cmd);
|
return $this->exec($cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user