diff --git a/tool/update_path_check.ps1 b/tool/update_path_check.ps1 index e09ba15..7d5bd9f 100644 --- a/tool/update_path_check.ps1 +++ b/tool/update_path_check.ps1 @@ -5,7 +5,11 @@ # 3. 시험이 끝나면 앱의 교체 스크립트가 배포 폴더를 바꾸고 새 판을 띄운다 (따로 데이터라 시작 메뉴를 건드리지 않음 - 121dd43). # 4. 새 판이 설정을 쓴 뒤 끄고 확인: 판 · 설정 · 모르는 키 · 동영상 목록 · 비밀번호 · 보관본 (비밀번호 없음) · 시작 메뉴 바로 가기 그대로. # 5. 시험 폴더를 지우고 jj_updtest_* 가 0개인지 본다. -# -NewZip 은 시작 메뉴 막기 (121dd43) 가 든 판이어야 한다 (아니면 새 판이 켜질 때 사용자 바로 가기를 바꾼다 - 그래서 먼저 판을 본다). +# 사용자 시작 메뉴를 지키는 두 겹 (관리자 지시 10/21, 28 지적): +# ① 시작 전에 -NewZip 안의 en.json 에 시작 메뉴 막기 (121dd43) 의 글이 있는지 본다 - 없으면 (10.20_001 과 그 전 판) 아무것도 하지 않고 멈춘다. +# 예전 판 (-OldStage) 은 켜지 않으므로 보지 않는다. +# ② 시작 전에 사용자 바로 가기 (.lnk 사본) 와 HKCU\Software\Classes\jjmkvmaker (reg export) 를 시험 폴더 밖 %TEMP%\jj_updtest_backup_<표> 에 +# 보관하고, 끝에 (시험 폴더를 지우기 전) 다르면 되돌린 뒤 같은지 다시 보고 크게 알린다. 같으면 보관본을 지운다 (되돌리지 못하면 남김). # 사용 (app 폴더에서): powershell -ExecutionPolicy Bypass -File tool\update_path_check.ps1 -NewZip [-OldStage <폴더>] [-From 2026.10.18_001] param( [Parameter(Mandatory = $true)][string]$NewZip, @@ -38,7 +42,34 @@ $userBefore = UserArea $sysTemp = [IO.Path]::GetTempPath() $tempBefore = @(Get-ChildItem $sysTemp -Force -Filter 'jj*' -ErrorAction SilentlyContinue | ForEach-Object { $_.Name }) +# ① 새 판에 시작 메뉴 막기가 있는지 (번역 글로 본다 - 121dd43 에서 생긴 글) +Add-Type -AssemblyName System.IO.Compression.FileSystem +$marker = 'Started with a test data folder (JJ_MKVMAKER_DATA)' +$zf = [IO.Compression.ZipFile]::OpenRead($NewZip) +try { + $en = $zf.Entries | Where-Object { $_.FullName -like '*/data/flutter_assets/assets/l10n/en.json' } | Select-Object -First 1 + $hasGuard = $false + if ($en) { $sr = New-Object IO.StreamReader($en.Open()); try { $hasGuard = $sr.ReadToEnd().Contains($marker) } finally { $sr.Dispose() } } +} finally { $zf.Dispose() } +if (-not $hasGuard) { + Write-Host "멈춤: $NewZip 에는 시작 메뉴 막기 (121dd43) 가 없습니다 - 이 판을 따로 데이터로 켜면 사용자 시작 메뉴 바로 가기 · jjmkvmaker:// 가 바뀝니다. 아무것도 하지 않았습니다." + exit 3 +} +Write-Host '통과: 새 판에 시작 메뉴 막기가 있음 (en.json)' + $tag = -join ((1..6) | ForEach-Object { '{0:x}' -f (Get-Random -Maximum 16) }) +# ② 사용자 바로 가기 · 주소 연결 보관 (시험 폴더 밖) +$B = Join-Path $sysTemp "jj_updtest_backup_$tag" +$protoKey = 'HKCU\Software\Classes\jjmkvmaker' +New-Item -ItemType Directory $B | Out-Null +$hadLnk = Test-Path $lnk +if ($hadLnk) { Copy-Item -LiteralPath $lnk "$B\JJ_MKVMaker.lnk" } +$hadProto = Test-Path 'HKCU:\Software\Classes\jjmkvmaker' +if ($hadProto) { + cmd /c "reg export `"$protoKey`" `"$B\jjmkvmaker.reg`" /y >nul 2>&1" + if ($LASTEXITCODE -ne 0) { throw "주소 연결을 보관하지 못함 (reg export $LASTEXITCODE) - 시작하지 않음" } +} +Write-Host "사용자 바로 가기 · 주소 연결 보관: $B (바로 가기 $hadLnk · 주소 연결 $hadProto)" $T = Join-Path $sysTemp "jj_updtest_$tag" $app = "$T\app"; $data = "$T\data"; $media = "$T\media"; $tmp = "$T\temp" New-Item -ItemType Directory $T, $data, $media, $tmp | Out-Null @@ -142,6 +173,23 @@ try { Check '사용자 시작 메뉴 바로 가기 · jjmkvmaker:// 그대로' ($userAfter -eq $userBefore) "($userAfter)" } finally { & $appProcs | Stop-Process -Force -ErrorAction SilentlyContinue + # ② 바뀌었으면 되돌림 (시험 폴더를 지우기 전) - 같은지 다시 보고, 같을 때만 보관본을 지운다 + $now = UserArea + if ($now -ne $userBefore) { + Write-Host '!!!!!!!! 사용자 시작 메뉴 바로 가기 · jjmkvmaker:// 가 바뀌었습니다 - 보관본으로 되돌립니다 !!!!!!!!' + Write-Host " 시험 전: $userBefore" + Write-Host " 시험 뒤: $now" + if ($hadLnk) { Copy-Item -LiteralPath "$B\JJ_MKVMaker.lnk" $lnk -Force } elseif (Test-Path $lnk) { Remove-Item -LiteralPath $lnk -Force } + # reg 의 오류 글은 cmd 안에서 버린다 (PowerShell 의 2>$null 은 Stop 에서 예외가 됨) + cmd /c "reg delete `"$protoKey`" /f >nul 2>&1" + if ($hadProto) { cmd /c "reg import `"$B\jjmkvmaker.reg`" >nul 2>&1" } + $restored = UserArea + # 되돌린 바로 가기는 고친 시각이 보관본 것과 같아야 한다 (Copy-Item 은 고친 시각을 그대로 둔다) + Check '되돌린 뒤 사용자 바로 가기 · 주소 연결이 시험 전과 같음' ($restored -eq $userBefore) "($restored)" + if ($restored -ne $userBefore) { Write-Host " 보관본을 남깁니다: $B" } + $fails.Add('사용자 시작 메뉴 · 주소 연결이 시험 중 바뀜 (되돌림)') + } + if ((UserArea) -eq $userBefore) { cmd /c "rd /s /q `"$B`" 2>nul" } for ($i = 0; $i -lt 30 -and (Test-Path -LiteralPath $T); $i++) { if ($i -gt 0) { Start-Sleep -Seconds 2 } cmd /c "rd /s /q `"\\?\$T`" 2>nul"