mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-06 00:46:53 +00:00
fix(win32): Missing LSP can now unzip on windows (#5594)
This commit is contained in:
16
packages/opencode/src/util/archive.ts
Normal file
16
packages/opencode/src/util/archive.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { $ } from "bun"
|
||||
import path from "path"
|
||||
|
||||
export namespace Archive {
|
||||
export async function extractZip(zipPath: string, destDir: string) {
|
||||
if (process.platform === "win32") {
|
||||
const winZipPath = path.resolve(zipPath)
|
||||
const winDestDir = path.resolve(destDir)
|
||||
// $global:ProgressPreference suppresses PowerShell's blue progress bar popup
|
||||
const cmd = `$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${winZipPath}' -DestinationPath '${winDestDir}' -Force`
|
||||
await $`powershell -NoProfile -NonInteractive -Command ${cmd}`.quiet()
|
||||
} else {
|
||||
await $`unzip -o -q ${zipPath} -d ${destDir}`.quiet()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user