Files
InventoryCheck/test
T
wed150 b2d81f4c9f
/ build (push) Has been cancelled
Add test
2026-06-19 12:24:50 +08:00

31 lines
1.2 KiB
Plaintext

# 1. 定义文件名
$fileName = "github_mirror.lua"
# 2. 获取当前工作目录的绝对路径 (例如: D:\a\your-repo\your-repo)
$currentDir = Get-Location
# 3. 拼接出绝对文件路径 (例如: D:\a\your-re_repo\your-repo\github_mirror.lua)
$absoluteFilePath = Join-Path $currentDir $fileName
# 4. 定义 Lua 脚本内容
$luaContent = @'
function mirror(url)
-- 强制将 github.com 替换为镜像域名
url = url:gsub("github.com", "github.bibk.top")
return url
end
-- main 函数允许处理该 URL
function main(url, host)
return true
end
'@
# 5. 使用绝对路径写入文件
$luaContent | Out-File -FilePath $absoluteFilePath -Encoding utf8
# 6. 输出调试信息 (可选,确认路径是否正确)
Write-Host "Mirror config generated at: $absoluteFilePath"
# 7. 配置 Xmake 使用该绝对路径的配置文件
xmake g --proxy_pac=$absoluteFilePath