From 005bae6857ddd05303342bffad2b00eeb25ba223 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Mon, 7 Sep 2020 02:36:21 +0530 Subject: [PATCH] Make sure printf is in PATH in Windows --- src/scripts/win32.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 8d40b9b6..f8c6f9c4 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -43,6 +43,19 @@ Function Add-ToProfile { } } +Function Add-Printf { + if (-not(Test-Path "C:\Program Files\Git\usr\bin\printf.exe")) { + if(Test-Path "C:\msys64\usr\bin\printf.exe") { + New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value C:\msys64\usr\bin\printf.exe + } else { + Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/printf/releases/latest/download/printf-x64.zip" -OutFile "$php_dir\printf.zip" + Expand-Archive -Path $php_dir\printf.zip -DestinationPath $php_dir -Force + } + } else { + New-Item -Path $php_dir\printf.exe -ItemType SymbolicLink -Value "C:\Program Files\Git\usr\bin\printf.exe" + } +} + Function Install-PhpManager() { $module_path = "$php_dir\PhpManager\PhpManager.psm1" if(-not (Test-Path $module_path -PathType Leaf)) { @@ -238,6 +251,7 @@ if(-not(Test-Path -LiteralPath $current_profile)) { New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1 } +Add-Printf >$null 2>&1 Step-Log "Setup PhpManager" Install-PhpManager >$null 2>&1 Add-Log $tick "PhpManager" "Installed"