31 lines
1.1 KiB
PowerShell
31 lines
1.1 KiB
PowerShell
param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$ManifestPath
|
|
)
|
|
|
|
if (!(Test-Path $ManifestPath)) {
|
|
Write-Host "[ERREUR] AndroidManifest.xml introuvable : $ManifestPath" -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
|
|
$text = Get-Content $ManifestPath -Raw
|
|
|
|
# Remplace les attributs existants.
|
|
$text = [regex]::Replace($text, 'android:label="[^"]*"', 'android:label="FIN65"')
|
|
$text = [regex]::Replace($text, 'android:icon="[^"]*"', 'android:icon="@mipmap/ic_launcher"')
|
|
$text = [regex]::Replace($text, 'android:roundIcon="[^"]*"', 'android:roundIcon="@mipmap/ic_launcher_round"')
|
|
|
|
# Ajoute les attributs s'ils n'existaient pas.
|
|
if ($text -notmatch 'android:label=') {
|
|
$text = $text -replace '<application', '<application android:label="FIN65"'
|
|
}
|
|
if ($text -notmatch 'android:icon=') {
|
|
$text = $text -replace '<application', '<application android:icon="@mipmap/ic_launcher"'
|
|
}
|
|
if ($text -notmatch 'android:roundIcon=') {
|
|
$text = $text -replace '<application', '<application android:roundIcon="@mipmap/ic_launcher_round"'
|
|
}
|
|
|
|
Set-Content -Path $ManifestPath -Value $text -Encoding UTF8
|
|
Write-Host "AndroidManifest.xml mis a jour."
|