From 88cf2e6ef90a2f5718856a9223cde53e9333c35a Mon Sep 17 00:00:00 2001 From: Miu <30835281+DreamMiu@users.noreply.github.com> Date: Sun, 19 Nov 2023 18:24:46 +0800 Subject: [PATCH] Fix install env issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在缺少Composer或者PHP一些文件夹不会创建的问题 --- ext/v3.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ext/v3.sh b/ext/v3.sh index eae26b4e..64b0e6fd 100755 --- a/ext/v3.sh +++ b/ext/v3.sh @@ -34,10 +34,18 @@ function download_file() { fi _down_symbol=0 if [ ! -f "$2" ]; then - echo -ne "$(nhead) 正在下载 $1 ... " + # 获取目录路径 + download_dir=$(dirname "$2") + + # 检查目录是否存在,如果不存在则创建 + if [ ! -d "$download_dir" ]; then + mkdir -p "$download_dir" + fi + + echo -ne "$(nhead) 正在下载 $1 到目录 $download_dir ... " $downloader "$1" -$_down_prefix "$2" >/dev/null 2>&1 && echo "完成!" && _down_symbol=1 else - echo "已存在!" && _down_symbol=1 + echo "文件已存在!" && _down_symbol=1 fi if [ $_down_symbol == 0 ]; then echo "$(nhead red) 下载失败!请检查网络连接!"