Enable rebuilding FFMPEG for MSVC without deleting lib files first

To simplify testing modifications to the FFMPEG library, it is nice to
be able to rebuild FFMPEG without having to manually delete lib files
first. This change makes this possible because it uses powershell
Move-Item instead of Rename-Item to rename .o files to .lib files.
Move-Item's -Force argument allows renaming files to destination that
already exists.

Change-Id: I0a56776d38c37d38d1cd74b5186881fc955d51f0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c4d26fe1d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Jøger Hansegård
2023-05-31 11:00:53 +02:00
committed by Qt Cherry-pick Bot
parent 55edbbaea0
commit d46ad89b2e

View File

@@ -119,7 +119,11 @@ function InstallMsvcFfmpeg {
Write-Host "Rename libraries lib*.a -> *.lib"
try {
$msvcDir = [System.Environment]::GetEnvironmentVariable("FFMPEG_DIR_MSVC", [System.EnvironmentVariableTarget]::Machine)
Get-ChildItem "$msvcDir\lib\lib*.a" | Rename-Item -NewName { $_.Name -replace 'lib(\w+).a$', '$1.lib' }
Get-ChildItem "$msvcDir\lib\lib*.a" | ForEach-Object {
$NewName = $_.Name -replace 'lib(\w+).a$', '$1.lib'
$Destination = Join-Path -Path $_.Directory.FullName -ChildPath $NewName
Move-Item -Path $_.FullName -Destination $Destination -Force
}
} catch {
Write-Host "Failed to rename libraries lib*.a -> *.lib"
return $false