diff --git a/bucket/zed.json b/bucket/zed.json index d212f59e86cf0c..fe7d20abc897ee 100644 --- a/bucket/zed.json +++ b/bucket/zed.json @@ -12,7 +12,29 @@ "installer": { "script": [ "Expand-InnoArchive -Path \"$dir\\$fname\" -ExtractDir '{app}'", - "Expand-InnoArchive -Path \"$dir\\$fname\" -ExtractDir '{code_GetInstallDir}' -Removal" + "Expand-InnoArchive -Path \"$dir\\$fname\" -ExtractDir '{code_GetInstallDir}' -Removal", + "# Turn off Auto Update", + "$zedSettingsPath = Join-Path $env:APPDATA 'Zed' 'settings.json'", + "$zedDir = Split-Path $zedSettingsPath", + "if (!(Test-Path $zedDir)) {", + " New-Item -ItemType Directory -Path $zedDir | Out-Null", + "}", + "if (Test-Path $zedSettingsPath) {", + " $jsonContent = Get-Content $zedSettingsPath -Raw | ConvertFrom-Json", + "}", + "if ($null -eq $jsonContent -or $false -ne $jsonContent.'auto_update') {", + " $response = Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/zed-industries/zed/refs/heads/main/assets/settings/initial_user_settings.json'", + " if ($response.StatusCode -eq 200) {", + " $initialSettings = $response.Content", + " $commentLines = $initialSettings.Substring(0, $initialSettings.IndexOf('{'))", + " if ($null -eq $jsonContent) {", + " $jsonContent = $initialSettings | ConvertFrom-Json", + " }", + " $jsonContent | Add-Member -NotePropertyName 'auto_update' -NotePropertyValue $false -Force", + " $finalText = ($commentLines + ($jsonContent | ConvertTo-Json -Depth 10)) -join '`n'", + " Set-Content $zedSettingsPath $finalText -Encoding UTF8", + " }", + "}" ] }, "bin": "bin\\zed.exe",