Make sure printf is in PATH in Windows

This commit is contained in:
Shivam Mathur 2020-09-07 02:36:21 +05:30
parent 446bccb14d
commit ab62fff526
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -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() { Function Install-PhpManager() {
$module_path = "$php_dir\PhpManager\PhpManager.psm1" $module_path = "$php_dir\PhpManager\PhpManager.psm1"
if(-not (Test-Path $module_path -PathType Leaf)) { 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 New-Item -Path $current_profile -ItemType "file" -Force >$null 2>&1
} }
Add-Printf >$null 2>&1
Step-Log "Setup PhpManager" Step-Log "Setup PhpManager"
Install-PhpManager >$null 2>&1 Install-PhpManager >$null 2>&1
Add-Log $tick "PhpManager" "Installed" Add-Log $tick "PhpManager" "Installed"