hi-client/copy_libcore.bat
shanshanzhong fed0b0e422
Some checks failed
Build Windows / ACT Windows Checkout Verification (push) Successful in 7h0m17s
Build Windows / build (push) Has been cancelled
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Has been cancelled
fix: 改进jq安装脚本的错误处理和日志输出
添加错误日志输出和文件清理逻辑,便于调试安装失败问题
2025-11-07 04:45:09 -08:00

86 lines
2.4 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
echo 📋 复制 libcore 文件...
:: 创建目标目录
mkdir libcore\bin >nul 2>&1
:: 查找并复制 HiddifyCli.exe重命名为 BearVPNCli.exe
for /r %%f in (HiddifyCli.exe) do (
if exist "%%f" (
echo ✅ 找到 HiddifyCli.exe: %%f
echo 📝 复制并重命名为 BearVPNCli.exe
copy "%%f" libcore\bin\BearVPNCli.exe
echo ✅ 重命名完成
goto :dll
)
)
echo ⚠️ 未找到 HiddifyCli.exe
:dll
:: 复制 libcore.dll
for /r %%f in (libcore.dll) do (
if exist "%%f" (
echo ✅ 找到 libcore.dll: %%f
copy "%%f" libcore\bin\libcore.dll
goto :install_jq
)
)
echo ⚠️ 未找到 libcore.dll
:install_jq
echo 📦 安装 jq...
:: 创建临时 PowerShell 脚本文件
echo if (!(Get-Command choco -ErrorAction SilentlyContinue)) { > install_jq.ps1
echo Set-ExecutionPolicy Bypass -Scope Process -Force; >> install_jq.ps1
echo [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; >> install_jq.ps1
echo iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) >> install_jq.ps1
echo } >> install_jq.ps1
echo choco install jq -y >> install_jq.ps1
echo $env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User') >> install_jq.ps1
echo jq --version >> install_jq.ps1
:: 执行 PowerShell 脚本并捕获输出
powershell -NoProfile -ExecutionPolicy Bypass -File install_jq.ps1 > install_jq_output.txt 2>&1
set PS_EXIT=%ERRORLEVEL%
:: 输出日志以调试
type install_jq_output.txt
echo PowerShell exit code: %PS_EXIT%
if %PS_EXIT% neq 0 (
echo ❌ jq 安装失败 (exit %PS_EXIT%)
del install_jq.ps1
del install_jq_output.txt
exit /b 1
)
:: 清理临时文件
del install_jq.ps1
del install_jq_output.txt
echo ✅ jq 安装成功
goto :verify
:verify
echo.
echo 📄 验证文件:
if exist libcore\bin (
dir libcore\bin
if exist libcore\bin\BearVPNCli.exe (
if exist libcore\bin\libcore.dll (
echo ✅ 验证成功:所有文件已正确复制
exit /b 0
) else (
echo ❌ 验证失败libcore.dll 不存在
exit /b 1
)
) else (
echo ❌ 验证失败BearVPNCli.exe 不存在
exit /b 1
)
) else (
echo ⚠️ libcore\bin 目录不存在
exit /b 1
)