MCPcopy Create free account
hub / github.com/xpf0000/FlyEnv / buildWriteFileScript

Function buildWriteFileScript

src/shared/WindowsHelperFallback.ts:568–581  ·  view source on GitHub ↗
(args: ValidatedWriteFileArgs, tempFilePath?: string)

Source from the content-addressed store, hash-verified

566}
567
568function buildWriteFileScript(args: ValidatedWriteFileArgs, tempFilePath?: string): string {
569 const contentExpression = tempFilePath
570 ? `Get-Content -LiteralPath ${powerShellString(tempFilePath)} -Raw`
571 : powerShellString(args.content)
572 return `${buildPowerShellPreamble()}
573$targetPath = ${powerShellString(args.targetPath)}
574$parentPath = Split-Path -Parent $targetPath
575if ($parentPath) {
576 New-Item -ItemType Directory -Path $parentPath -Force | Out-Null
577}
578$content = ${contentExpression}
579$utf8NoBom = [System.Text.UTF8Encoding]::new($false)
580[System.IO.File]::WriteAllText($targetPath, $content, $utf8NoBom)`
581}
582
583function buildWriteBufferScript(args: ValidatedWriteBufferArgs, tempFilePath?: string): string {
584 const base64Expression = tempFilePath

Callers 1

Calls 2

powerShellStringFunction · 0.85
buildPowerShellPreambleFunction · 0.85

Tested by

no test coverage detected