Files
Archive/scripts/package-portable.ps1
T
강 한andClaude Fable 5 a734ba21b9 포터블 zip에 portable.marker 추가 — Compress-Archive가 빈 data\ 폴더를 누락하는 문제 수정
Compress-Archive는 빈 디렉터리를 zip에 넣지 않아, 포터블 감지 신호였던
data\ 폴더가 배포 zip에서 사라졌다. 그 결과 압축 해제 후 실행하면
포터블 모드가 아닌 %APPDATA%에 데이터를 저장했다(x64/ARM64 공통).
paths.rs가 인식하는 portable.marker 파일을 스테이지에 추가해 해결.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 16:33:46 +09:00

66 lines
2.7 KiB
PowerShell

# Windows 포터블 zip 패키징.
# 사용: .\scripts\package-portable.ps1 [-Target x64|arm64]
# 결과: dist-portable\Archive-<ver>-windows-<arch>.zip
# 내용: Archive.exe, ffmpeg.exe, ffprobe.exe, data\(빈 폴더 → 포터블 모드), README.txt
param(
[ValidateSet("x64", "arm64")]
[string]$Target = "x64"
)
$ErrorActionPreference = "Stop"
$root = Split-Path $PSScriptRoot -Parent
$triple = if ($Target -eq "x64") { "x86_64-pc-windows-msvc" } else { "aarch64-pc-windows-msvc" }
# 버전 (tauri.conf.json)
$conf = Get-Content "$root\src-tauri\tauri.conf.json" -Raw | ConvertFrom-Json
$ver = $conf.version
$exe = if ($Target -eq "x64") {
"$root\src-tauri\target\release\archive.exe"
} else {
"$root\src-tauri\target\$triple\release\archive.exe"
}
if (-not (Test-Path $exe)) {
throw "빌드 산출물이 없습니다: $exe (먼저 tauri build --no-bundle 실행)"
}
$ffmpeg = "$root\src-tauri\binaries\ffmpeg-$triple.exe"
$ffprobe = "$root\src-tauri\binaries\ffprobe-$triple.exe"
if (-not (Test-Path $ffmpeg)) {
throw "ffmpeg 사이드카 없음: $ffmpeg (scripts\fetch-ffmpeg.ps1 -Target win$($Target -replace 'x','') 먼저 실행)"
}
$stage = "$root\dist-portable\stage-$Target"
Remove-Item -Recurse -Force $stage -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force "$stage\data" | Out-Null
# Compress-Archive는 빈 폴더(data\)를 zip에 넣지 않는다 → 포터블 감지용 마커 파일을 둔다.
# paths.rs가 exe 옆 portable.marker 또는 data\ 존재 시 포터블 모드로 동작.
Set-Content "$stage\portable.marker" "이 파일이 있으면 exe 옆 data\ 에 인덱스를 저장하는 포터블 모드로 실행됩니다." -Encoding utf8
Copy-Item $exe "$stage\Archive.exe"
Copy-Item $ffmpeg "$stage\ffmpeg.exe"
Copy-Item $ffprobe "$stage\ffprobe.exe"
@"
Archive $ver — 포터블 (무설치)
실행: Archive.exe 를 더블클릭하세요.
- 이 폴더의 data\ 하위에 인덱스(archive.db)와 썸네일이 저장됩니다.
폴더째로 USB/다른 PC로 옮겨도 그대로 동작합니다.
- WebView2 런타임이 필요합니다. Windows 11과 최신 Windows 10에는
기본 설치되어 있습니다. 없다면 아래에서 설치하세요:
https://developer.microsoft.com/microsoft-edge/webview2/
문제가 있으면 data\logs\ 의 로그를 확인하세요.
"@ | Set-Content "$stage\README.txt" -Encoding utf8
$outDir = "$root\dist-portable"
$zip = "$outDir\Archive-$ver-windows-$Target.zip"
Remove-Item $zip -ErrorAction SilentlyContinue
Compress-Archive -Path "$stage\*" -DestinationPath $zip -CompressionLevel Optimal
Remove-Item -Recurse -Force $stage
$sizeMB = [math]::Round((Get-Item $zip).Length / 1MB, 1)
Write-Host "[package-portable] 완료: $zip ($sizeMB MB)"