Files
youtube_personal/restore_18_7_5.ps1
T

42 lines
1.3 KiB
PowerShell

param(
[Parameter(Mandatory=$false)]
[string]$ProjectPath = "D:\07-Logiciels\23-youtube_personal"
)
$ErrorActionPreference = "Stop"
$stamp = Get-Date -Format "yyyyMMdd_HHmmss"
$backupRoot = Join-Path $ProjectPath "_backup_before_restore_18_7_5_$stamp"
$files = @(
"lib\screens\video_player_page.dart",
"lib\services\windows_hd_service.dart"
)
Write-Host "Baseline protegee YouTube Personal 18.7.5"
Write-Host "Projet : $ProjectPath"
Write-Host "Sauvegarde actuelle : $backupRoot"
foreach ($relative in $files) {
$current = Join-Path $ProjectPath $relative
if (Test-Path $current) {
$backup = Join-Path $backupRoot $relative
New-Item -ItemType Directory -Force -Path (Split-Path $backup) | Out-Null
Copy-Item -Force $current $backup
}
}
foreach ($relative in $files) {
$source = Join-Path $PSScriptRoot $relative
$target = Join-Path $ProjectPath $relative
if (-not (Test-Path $source)) {
throw "Fichier baseline introuvable : $source"
}
New-Item -ItemType Directory -Force -Path (Split-Path $target) | Out-Null
Copy-Item -Force $source $target
Write-Host "Restaure : $relative"
}
Write-Host ""
Write-Host "Restauration 18.7.5 terminee."
Write-Host "Ancienne version sauvegardee dans : $backupRoot"