try{[Console]::OutputEncoding=New-Object System.Text.UTF8Encoding}catch{} $here=$PSScriptRoot; if(-not $here){ $here=Split-Path -Parent $MyInvocation.MyCommand.Path } $root=Split-Path -Parent $here $bin =Join-Path $root 'bin' $sdir=Join-Path $root 'scripts' function Get-Version([string]$name){ $m=[regex]::Match($name,'_v([0-9]+(?:\.[0-9]+)*)\.ps1$') if($m.Success){ try{ return [version]$m.Groups[1].Value }catch{ return [version]'0.0' } } else { return [version]'0.0' } } # 1) wrapper launcher v1.9 -> pr?-vol auto-fix + d?l?gation vers la meilleure version existante $wrap = Join-Path $sdir 'gov_profile_launcher_v1.9.ps1' if(!(Test-Path $wrap)){ $w=@" try{[Console]::OutputEncoding=New-Object System.Text.UTF8Encoding}catch{} \$here=\$PSScriptRoot; if(-not \$here){ \$here=Split-Path -Parent \$MyInvocation.MyCommand.Path } \$root=Split-Path -Parent \$here \$bin =Join-Path \$root 'bin' $(if(# pr){ -vol } else { alias+shims puis normalisation encodage (scripts) }) \$ens=Join-Path \$bin 'ensure_aliases_and_shims_latest.cmd' if(Test-Path \$ens){ & \$ens | Out-Null } \$enc=Join-Path \$bin 'text_encoding_guard_latest.cmd' if(Test-Path \$enc){ & \$enc -Scope Scripts -Write | Out-Null } # d?l?gation propre vers le meilleur gov_profile_launcher_v*.ps1 (hors v1.9) function Get-Version([string]\$name){ \$m=[regex]::Match(\$name,'_v([0-9]+(?:\.[0-9]+)*)\.ps1$') if(\$m.Success){ try{ return [version]\$m.Groups[1].Value }catch{ return [version]'0.0' } } else { return [version]'0.0' } } \$cands=Get-ChildItem -LiteralPath (Join-Path \$root 'scripts') -Filter 'gov_profile_launcher_v*.ps1' -File -EA SilentlyContinue | Where-Object { \$_.Name -ne 'gov_profile_launcher_v1.9.ps1' } if(-not \$cands){ Write-Host '[BLOCK] aucun launcher versionn? trouv? (hors v1.9).'; exit 2 } \$best=(\$cands | Sort-Object @{Expression={ Get-Version \$_.Name };Descending=\$true}, @{Expression={\$_.LastWriteTime};Descending=\$true} | Select-Object -First 1) powershell -NoProfile -ExecutionPolicy Bypass -File \$best.FullName @args "@ [IO.File]::WriteAllText($wrap,$w,[Text.UTF8Encoding]::new($false)) } # alias latest -> v1.9 (pour activer le pr?-vol partout) $alias = Join-Path $bin 'gov_profile_launcher_latest.cmd' $cmd='@echo off'+"`r`n"+'setlocal'+"`r`n"+ 'set "SELF=%~dp0"'+"`r`n"+'for %%I in ("%SELF%..") do set "ROOT=%%~fI"'+"`r`n"+ 'powershell -NoProfile -ExecutionPolicy Bypass -File "%ROOT%\scripts\gov_profile_launcher_v1.9.ps1" %*'+"`r`n" [IO.File]::WriteAllText($alias,$cmd,[Text.ASCIIEncoding]::new()) Write-Host 'OK - launcher wrapper v1.9 install? (pr?-vol auto-fix branch?).'