修正windows打包路径问题

(cherry picked from commit 93ca88fa49d3bd3422b5f05243ec9dfad47c2a77)
This commit is contained in:
Rust 2025-10-29 12:08:06 +08:00 committed by speakeloudest
parent 41f85a6747
commit 0449e04f42
2 changed files with 59 additions and 31 deletions

View File

@ -381,39 +381,66 @@ jobs:
uses: actions/download-artifact@v4
with:
name: libcore-windows
path: .
path: libcore_windows_temp
- name: 🔧 复制 libcore 文件到正确位置并重命名
shell: bash
run: |
echo "📋 复制 libcore 文件..."
Write-Host "📋 开始复制 libcore 文件..."
# 显示下载的文件结构
Write-Host "🔍 检查下载的文件结构:"
Get-ChildItem -Recurse libcore_windows_temp -ErrorAction SilentlyContinue | Format-Table Name, FullName
# 确保目标目录存在
mkdir -p libcore/bin
New-Item -ItemType Directory -Force -Path "libcore\bin" | Out-Null
# 复制并重命名文件
if [ -f "HiddifyCli.exe" ]; then
echo "✅ 找到 HiddifyCli.exe重命名为 BearVPNCli.exe"
cp HiddifyCli.exe libcore/bin/BearVPNCli.exe
fi
# 查找 libcore.dll可能在 libcore_windows_temp/bin/ 或 libcore_windows_temp/libcore/bin/
$dllFiles = Get-ChildItem -Path libcore_windows_temp -Recurse -Filter "libcore.dll" -ErrorAction SilentlyContinue
if ($dllFiles) {
$sourceDll = $dllFiles[0].FullName
Write-Host "✅ 找到 libcore.dll: $sourceDll"
Copy-Item $sourceDll "libcore\bin\libcore.dll" -Force
} else {
Write-Host "❌ 未找到 libcore.dll"
Write-Host "当前目录内容:"
Get-ChildItem -Path . -Recurse | Select-Object -First 20 | Format-Table Name, FullName
exit 1
}
if [ -f "libcore.dll" ]; then
echo "✅ 找到 libcore.dll"
cp libcore.dll libcore/bin/
fi
# 查找并复制 HiddifyCli.exe重命名为 BearVPNCli.exe
$exeFiles = Get-ChildItem -Path libcore_windows_temp -Recurse -Filter "HiddifyCli.exe" -ErrorAction SilentlyContinue
if ($exeFiles) {
$sourceExe = $exeFiles[0].FullName
Write-Host "✅ 找到 HiddifyCli.exe: $sourceExe重命名为 BearVPNCli.exe"
Copy-Item $sourceExe "libcore\bin\BearVPNCli.exe" -Force
} else {
Write-Host "⚠️ 未找到 HiddifyCli.exe这不是致命错误"
}
# 如果下载到子目录,也需要处理
if [ -d "libcore-windows" ]; then
if [ -f "libcore-windows/HiddifyCli.exe" ]; then
cp libcore-windows/HiddifyCli.exe libcore/bin/BearVPNCli.exe
fi
if [ -f "libcore-windows/libcore.dll" ]; then
cp libcore-windows/libcore.dll libcore/bin/
fi
fi
# 复制 webui 目录
$webuiDir = Get-ChildItem -Path libcore_windows_temp -Recurse -Filter "webui" -Directory -ErrorAction SilentlyContinue
if ($webuiDir) {
Write-Host "✅ 找到 webui 目录: $($webuiDir[0].FullName)"
Copy-Item -Path $webuiDir[0].FullName -Destination "libcore\bin\webui" -Recurse -Force
} else {
Write-Host "⚠️ 未找到 webui 目录(这不是致命错误)"
}
echo "📄 验证文件..."
ls -lh libcore/bin/ || echo "目录为空"
Write-Host ""
Write-Host "📄 验证复制后的文件结构:"
if (Test-Path "libcore\bin") {
Get-ChildItem libcore\bin\ -Recurse | Format-Table Name, FullName, Length
} else {
Write-Host "❌ libcore\bin 目录不存在"
}
if (-not (Test-Path "libcore\bin\libcore.dll")) {
Write-Host "❌ libcore.dll 未正确复制到 libcore\bin\"
exit 1
}
Write-Host "✅ libcore 文件复制完成"
shell: pwsh
- name: ⚙️ 配置 API、OSS 和加密密钥
shell: bash

View File

@ -94,14 +94,15 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
# install(FILES "../libcore/bin/libcore.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
# COMPONENT Runtime)
# libcore.dll
install(FILES "${CMAKE_SOURCE_DIR}/libcore/bin/libcore.dll"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
install(FILES "../libcore/bin/libcore.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime RENAME libcore.dll)
install(FILES "../libcore/bin/BearVPNCli.exe" DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime RENAME BearVPNCli.exe)
# BearVPNCli.exe
install(FILES "${CMAKE_SOURCE_DIR}/libcore/bin/BearVPNCli.exe"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
if(PLUGIN_BUNDLED_LIBRARIES)