mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-05 15:55:39 +08:00
refactor and add more linux extensions and libraries
This commit is contained in:
@@ -228,6 +228,10 @@ class Downloader
|
||||
*/
|
||||
public static function fetchSource(string $name, array $source): void
|
||||
{
|
||||
// 如果是 git 类型,且没有设置 path,那我就需要指定一下 path
|
||||
if ($source['type'] === 'git' && !isset($source['path'])) {
|
||||
$source['path'] = $name;
|
||||
}
|
||||
// 避免重复 fetch
|
||||
if (!isset($source['path']) && is_dir(FileSystem::convertPath(DOWNLOAD_PATH . "/{$name}")) || isset($source['path']) && is_dir(FileSystem::convertPath(SOURCE_PATH . "/{$source['path']}"))) {
|
||||
logger()->notice("{$name} source already extracted");
|
||||
|
||||
@@ -378,4 +378,11 @@ class FileSystem
|
||||
}
|
||||
return $ret === 0;
|
||||
}
|
||||
|
||||
public static function createDir(string $path): void
|
||||
{
|
||||
if (!is_dir($path) && !mkdir($path, 0755, true) && !is_dir($path)) {
|
||||
throw new FileSystemException(sprintf('无法建立目录:%s', $path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user