修正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 uses: actions/download-artifact@v4
with: with:
name: libcore-windows name: libcore-windows
path: . path: libcore_windows_temp
- name: 🔧 复制 libcore 文件到正确位置并重命名 - name: 🔧 复制 libcore 文件到正确位置并重命名
shell: bash
run: | 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
# 复制并重命名文件 # 查找 libcore.dll可能在 libcore_windows_temp/bin/ 或 libcore_windows_temp/libcore/bin/
if [ -f "HiddifyCli.exe" ]; then $dllFiles = Get-ChildItem -Path libcore_windows_temp -Recurse -Filter "libcore.dll" -ErrorAction SilentlyContinue
echo "✅ 找到 HiddifyCli.exe重命名为 BearVPNCli.exe" if ($dllFiles) {
cp HiddifyCli.exe libcore/bin/BearVPNCli.exe $sourceDll = $dllFiles[0].FullName
fi 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 # 查找并复制 HiddifyCli.exe重命名为 BearVPNCli.exe
echo "✅ 找到 libcore.dll" $exeFiles = Get-ChildItem -Path libcore_windows_temp -Recurse -Filter "HiddifyCli.exe" -ErrorAction SilentlyContinue
cp libcore.dll libcore/bin/ if ($exeFiles) {
fi $sourceExe = $exeFiles[0].FullName
Write-Host "✅ 找到 HiddifyCli.exe: $sourceExe重命名为 BearVPNCli.exe"
Copy-Item $sourceExe "libcore\bin\BearVPNCli.exe" -Force
} else {
Write-Host "⚠️ 未找到 HiddifyCli.exe这不是致命错误"
}
# 如果下载到子目录,也需要处理 # 复制 webui 目录
if [ -d "libcore-windows" ]; then $webuiDir = Get-ChildItem -Path libcore_windows_temp -Recurse -Filter "webui" -Directory -ErrorAction SilentlyContinue
if [ -f "libcore-windows/HiddifyCli.exe" ]; then if ($webuiDir) {
cp libcore-windows/HiddifyCli.exe libcore/bin/BearVPNCli.exe Write-Host "✅ 找到 webui 目录: $($webuiDir[0].FullName)"
fi Copy-Item -Path $webuiDir[0].FullName -Destination "libcore\bin\webui" -Recurse -Force
if [ -f "libcore-windows/libcore.dll" ]; then } else {
cp libcore-windows/libcore.dll libcore/bin/ Write-Host "⚠️ 未找到 webui 目录(这不是致命错误)"
fi }
fi
echo "📄 验证文件..." Write-Host ""
ls -lh libcore/bin/ || echo "目录为空" 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 和加密密钥 - name: ⚙️ 配置 API、OSS 和加密密钥
shell: bash 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}" install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime) COMPONENT Runtime)
# install(FILES "../libcore/bin/libcore.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" # libcore.dll
# COMPONENT Runtime) 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}" # BearVPNCli.exe
COMPONENT Runtime RENAME libcore.dll) install(FILES "${CMAKE_SOURCE_DIR}/libcore/bin/BearVPNCli.exe"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
install(FILES "../libcore/bin/BearVPNCli.exe" DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime)
COMPONENT Runtime RENAME BearVPNCli.exe)
if(PLUGIN_BUNDLED_LIBRARIES) if(PLUGIN_BUNDLED_LIBRARIES)